class TestGeneraldistribution(unittest.TestCase): def setUp(self): self.distribution = Distribution() def test_txt(self): self.distribution.read_data_file('probdists/numbers_space.txt') self.assertEqual(self.distribution.data, [1, 2, 3.4, 5.6, 7], 'Txt file not read properly') def test_txt_sep(self): self.distribution.read_data_file('probdists/numbers_semicolon.txt', ';') self.assertEqual(self.distribution.data, [1, 2, 2.34, 5.67], 'Txt file wit custom separator not read properly') def test_csv(self): self.distribution.read_data_file('probdists/numbers.csv') self.assertEqual(self.distribution.data, [1434.0, 1453.0, 1412.0, 1489.0, 1507.0], 'CSV file not read properly') def test_excel(self): self.distribution.read_data_file('probdists/numbers.xls') self.assertEqual(self.distribution.data, [1, 2, 3, 4, 5, 6, 7, 8, 9], 'Xls file not read properly')
def setUp(self): self.distribution = Distribution()