Ejemplo n.º 1
0
    def test_results_file(self):
        try:
            os.remove('results.txt')
        except IOError:
            pass

        positions = [1, 10, 100, 1000]
        no_trials = 1000

        Investment.calculate_for_positions(positions, no_trials)
        self.assertTrue(os.path.isfile('results.txt'))
Ejemplo n.º 2
0
    def test_plots_files(self):
        try:
            os.remove('histogram_0001_pos.pdf')
            os.remove('histogram_0010_pos.pdf')
            os.remove('histogram_0100_pos.pdf')
            os.remove('histogram_1000_pos.pdf')
        except IOError:
            pass

        positions = [1, 10, 100, 1000]
        no_trials = 1000

        Investment.calculate_for_positions(positions, no_trials)
        self.assertTrue(os.path.isfile('histogram_0001_pos.pdf'))
        self.assertTrue(os.path.isfile('histogram_0010_pos.pdf'))
        self.assertTrue(os.path.isfile('histogram_0100_pos.pdf'))
        self.assertTrue(os.path.isfile('histogram_1000_pos.pdf'))