If the pneumonia is more advanced, the health care provider may perform a bronchoscopy, which is a test that looks at the lungs with a special scope. During a bronchoscopy the health care provider can clear out some of the pus and phlegm from the bronchiole tubes, which could not be coughed out.