

import unittest
from plot_pollutants import plot_pollutants
import pandas as pd


df = pd.read_csv("../data/pollution_us_2000_2016.csv")
year="2010"
state="Arizona"

class TestPlot(unittest.TestCase):
  
    def testPlotPollutants(self):
        
        result=plot_pollutants(df, year, state)
        expected_explanation="Levels of pollutants plotted."
        self.assertTrue(result, expected_explanation)

if __name__ == '__main__':
    unittest.main()


import unittest
from plot_pollutants import plot_pollutants
import pandas as pd


df = pd.read_csv("../data/pollution_us_2000_2016.csv")
year="2010"
state="Arizona"

class TestPlot(unittest.TestCase):
  
    def testPlotPollutants(self):
        
        fig, flag = plot_pollutants(df, year, state)
        expected_explanation="Levels of pollutants plotted."
        self.assertEqual(flag, expected_explanation)

if __name__ == '__main__':
    unittest.main()

Add flag to plot_pollutant unit test
Add flag to plot_pollutant unit test

also change assertTrue to assertEqual
  
  
  import unittest
  from plot_pollutants import plot_pollutants
  import pandas as pd
  
  
  df = pd.read_csv("../data/pollution_us_2000_2016.csv")
  year="2010"
  state="Arizona"
  
  class TestPlot(unittest.TestCase):
    
      def testPlotPollutants(self):
          
-         result=plot_pollutants(df, year, state)
+         fig, flag = plot_pollutants(df, year, state)
          expected_explanation="Levels of pollutants plotted."
-         self.assertTrue(result, expected_explanation)
+         self.assertEqual(flag, expected_explanation)
  
  if __name__ == '__main__':
      unittest.main()
+ 
Add flag to plot_pollutant unit test
## Code Before:


import unittest
from plot_pollutants import plot_pollutants
import pandas as pd


df = pd.read_csv("../data/pollution_us_2000_2016.csv")
year="2010"
state="Arizona"

class TestPlot(unittest.TestCase):
  
    def testPlotPollutants(self):
        
        result=plot_pollutants(df, year, state)
        expected_explanation="Levels of pollutants plotted."
        self.assertTrue(result, expected_explanation)

if __name__ == '__main__':
    unittest.main()
## Instruction:
Add flag to plot_pollutant unit test
## Code After:


import unittest
from plot_pollutants import plot_pollutants
import pandas as pd


df = pd.read_csv("../data/pollution_us_2000_2016.csv")
year="2010"
state="Arizona"

class TestPlot(unittest.TestCase):
  
    def testPlotPollutants(self):
        
        fig, flag = plot_pollutants(df, year, state)
        expected_explanation="Levels of pollutants plotted."
        self.assertEqual(flag, expected_explanation)

if __name__ == '__main__':
    unittest.main()
