def test_combine_results(self): res1 = get_results() res2 = get_results() # First split them res1.drop('step_wise', axis=1, level=1, inplace=True) res2.drop('power_allocator', axis=1, level=1, inplace=True) # Now combine them again combined = combine_results([res1, res2]) self.assertEquals(type(combined), Result) self.assertEquals(combined["antutu"]["step_wise"][0], 4) self.assertEquals(combined["antutu"]["power_allocator"][0], 5) self.assertEquals(combined["geekbench"]["power_allocator"][1], 1) self.assertEquals(combined["t-rex_offscreen"]["step_wise"][2], 424)
def test_get_results_path(self): """get_results() can be given a directory for the results.csv""" other_random_dir = tempfile.mkdtemp() os.chdir(other_random_dir) results_frame = get_results(self.out_dir) self.assertEquals(len(results_frame.columns), 10)
def test_get_results_filename(self): """get_results() can be given a specific filename""" old_path = os.path.join(self.out_dir, "results.csv") new_path = os.path.join(self.out_dir, "new_results.csv") os.rename(old_path, new_path) results_frame = get_results(new_path) self.assertEquals(len(results_frame.columns), 10)
def test_plot_results(self): """Test Result.plot_results() Can't test it, so just check that it doens't bomb """ res = get_results() res.plot_results() matplotlib.pyplot.close('all')
def test_get_results(self): results_frame = get_results() self.assertEquals(type(results_frame), Result) self.assertEquals(type(results_frame.columns), pd.core.index.MultiIndex) self.assertEquals(results_frame["antutu"]["power_allocator"][0], 5) self.assertEquals(results_frame["antutu"]["step_wise"][1], 9) self.assertEquals(results_frame["antutu"]["step_wise"][2], 7) self.assertEquals(results_frame["t-rex_offscreen"]["power_allocator"][0], 1777) self.assertEquals(results_frame["geekbench"]["step_wise"][0], 8) self.assertEquals(results_frame["geekbench"]["power_allocator"][1], 1) self.assertAlmostEquals(results_frame["thechase"]["step_wise"][0], 242.0522258138)
def test_get_results(self): results_frame = get_results() self.assertEqual(type(results_frame), Result) self.assertEqual(type(results_frame.columns), pd.core.index.MultiIndex) self.assertEqual(results_frame["antutu"]["power_allocator"][0], 5) self.assertEqual(results_frame["antutu"]["step_wise"][1], 9) self.assertEqual(results_frame["antutu"]["step_wise"][2], 7) self.assertEqual(results_frame["t-rex_offscreen"]["power_allocator"][0], 1777) self.assertEqual(results_frame["geekbench"]["step_wise"][0], 8) self.assertEqual(results_frame["geekbench"]["power_allocator"][1], 1) self.assertAlmostEquals(results_frame["thechase"]["step_wise"][0], 242.0522258138)
def test_plot_results_benchmark(self): """Test Result.plot_results_benchmark() Can't test it, so just check that it doens't bomb """ res = get_results() res.plot_results_benchmark("antutu") res.plot_results_benchmark("t-rex_offscreen", title="Glbench TRex") (_, _, y_min, y_max) = matplotlib.pyplot.axis() trex_data = pd.concat(res["t-rex_offscreen"][s] for s in res["t-rex_offscreen"]) data_min = min(trex_data) data_max = max(trex_data) # Fail if the axes are within the limits of the data. self.assertTrue(data_min > y_min) self.assertTrue(data_max < y_max) matplotlib.pyplot.close('all')
def test_get_results_name(self): """get_results() optional name argument overrides the one in the results file""" res = get_results(name="malkovich") self.assertIsNotNone(res["antutu"]["malkovich"])
def test_init_fig(self): r1 = get_results() r1.init_fig()