Ejemplo n.º 1
0
    def test_graphical_explorer(self):
        try:
            os.remove('./histogram_SOUTH AMERICA_2008.png')
            os.remove('./histogram_NORTH AMERICA_2009.png')
            os.remove('./boxplot_NORTH AMERICA_2010.png')
        except OSError:
            pass

        plot_income_by_region.graphical_explorer(2008)
        plot_income_by_region.graphical_explorer(2009)
        plot_income_by_region.graphical_explorer(2010)


        self.assertTrue(os.path.isfile('./histogram_SOUTH AMERICA_2008.png'))
        self.assertTrue(os.path.isfile('./histogram_NORTH AMERICA_2009.png'))
        self.assertTrue(os.path.isfile('./boxplot_NORTH AMERICA_2010.png'))
Ejemplo n.º 2
0
        continue
    except loader_Error as e:
        print str(e)

user_input_2 = "hey"

while user_input_2 <> "finish":  #Loop until user inputs 'finish'

    try:
        user_input_2 = raw_input('Please enter another year from 1800 to 2012.  '
                                 'If you do not want to enter more years, please write "finish". '
                                 'No spaces are allowed.')

        if user_input_2 in  list_of_valid_years:
            year = int(user_input_2)
            loaderandmerger.loader_merger_histogram.income_distribution_hist(year)

        elif ((user_input_2 not in list_of_valid_years) and (user_input_2!="finish")):
            print "Please enter a valid year from 1800 to 2012"

    except (KeyboardInterrupt, EOFError): #avoid interrupting the program
        continue
    except loader_Error as e:
            print str(e)


for year in range(2007, 2013):   #plot histograms and boxplots from years 2007-2012
    try:
        plot_income_by_region.graphical_explorer(year)
    except loader_Error as e:
        print str(e)