def test_graph_years(self):

        ev = EconVisualizer()
        with self.assertRaises(TypeError):
            ev.graph_years()
        with self.assertRaises(ValueError):
            ev.graph_years(1900)
        with self.assertRaises(ValueError):
            ev.graph_years([1900, 1200, 1902])
示例#2
0
            sys.exit(0)

        except EOFError:
            # Exit if the user enters Ctrl+D
            sys.exit(0)

        if user_input.lower() == 'finish':
            break

        try:
            year = int(user_input)
        except ValueError:
            print("year must be an integer. Try again?")
            continue

        try:
            graph_income(income, year)

        except ValueError:
            print('year ' + str(year) + " not in range. Try again?")

        except TypeError:
            print('year must be int-like. Try again?')
    """
    Here out of the while loop, the user had to exit the while loop by typing Finish.
    Now we generate graphs for the years 2007-2012.
    """
    ev = EconVisualizer(income, countries)
    ev.graph_years(list(range(2007, 2013)))
    print("Report completetd. See boxplots and histograms of reported data")
示例#3
0
        except EOFError:
            # Exit if the user enters Ctrl+D
            sys.exit(0)

        if user_input.lower() == "finish":
            break

        try:
            year = int(user_input)
        except ValueError:
            print("year must be an integer. Try again?")
            continue

        try:
            graph_income(income, year)

        except ValueError:
            print("year " + str(year) + " not in range. Try again?")

        except TypeError:
            print("year must be int-like. Try again?")

    """
    Here out of the while loop, the user had to exit the while loop by typing Finish.
    Now we generate graphs for the years 2007-2012.
    """
    ev = EconVisualizer(income, countries)
    ev.graph_years(list(range(2007, 2013)))
    print("Report completetd. See boxplots and histograms of reported data")