def test_parse_timing_directory_bad(self): """Raises error with a wrong directory structure""" with open(join(self.results_dir, "foo.txt"), "w") as f: f.write("bar\n") with self.assertRaises(ValueError): list(parse_timing_directory(self.results_dir))
def test_parse_timing_directory_bad(self): """Raises error with a wrong directory structure""" with open(join(self.results_dir, 'foo.txt'), 'w') as f: f.write('bar\n') with self.assertRaises(ValueError): list(parse_timing_directory(self.results_dir))
def test_parse_timing_directory_correct(self): """Correctly retrieves the measurements from the timing directory""" obs = list(parse_timing_directory(self.results_dir)) exp = [ BenchCase( "10", [415.29, 392.73, 396.18, 392.42, 390.61], [388.29, 381.52, 382.33, 382.32, 382.26], [11.35, 5.60, 5.45, 5.49, 5.50], [9710640, 9710576, 9710624, 9710384, 9710512], ), BenchCase( "20", [815.21, 820.33, 788.19, 779.50, 784.72], [771.32, 799.58, 765.59, 755.76, 763.28], [22.17, 11.57, 11.02, 11.60, 11.36], [18742320, 18744128, 18742704, 18742352, 18744976], ), BenchCase( "30", [1240.57, 1191.88, 1202.94, 1181.67, 1197.96], [1177.48, 1157.41, 1174.34, 1151.60, 1170.66], [32.92, 16.28, 15.95, 16.27, 16.62], [27386400, 27389792, 27392640, 27393424, 27392224], ), ] self.assertEqual(obs, exp)
def test_parse_timing_directory_correct(self): """Correctly retrieves the measurements from the timing directory""" obs = list(parse_timing_directory(self.results_dir)) exp = [ BenchCase('10', [415.29, 392.73, 396.18, 392.42, 390.61], [388.29, 381.52, 382.33, 382.32, 382.26], [11.35, 5.60, 5.45, 5.49, 5.50], [9710640, 9710576, 9710624, 9710384, 9710512]), BenchCase('20', [815.21, 820.33, 788.19, 779.50, 784.72], [771.32, 799.58, 765.59, 755.76, 763.28], [22.17, 11.57, 11.02, 11.60, 11.36], [18742320, 18744128, 18742704, 18742352, 18744976]), BenchCase('30', [1240.57, 1191.88, 1202.94, 1181.67, 1197.96], [1177.48, 1157.41, 1174.34, 1151.60, 1170.66], [32.92, 16.28, 15.95, 16.27, 16.62], [27386400, 27389792, 27392640, 27393424, 27392224]) ] self.assertEqual(obs, exp)