def test_fail_if_supports_runtime_stats(self): stats = Stats() stats.measure(103.2) stats.measure(205.2) timed_stats = TimedStats(1, 2, stats) result = Result({}, 'select name', timed_stats, 1) with self.assertRaises(FailIf): eval_fail_if("{runtime_stats.max} > 30", result)
def test_short_result_output_with_only_1_measurement(self): stats = Stats(1) stats.measure(23.4) self.assertEqual( format_stats(stats.get(), 'short'), ('Runtime (in ms):\n' ' mean: 23.400 ± 0.000') )
def test_short_result_output_with_only_1_measurement(self): stats = Stats() stats.measure(23.4) self.assertEqual( format_stats(stats.get(), 'short'), ('Runtime (in ms):\n' ' mean: 23.400 ± 0.000') )
def test_short_result_output_with_more_measurements(self): stats = Stats(4) stats.measure(23.4) stats.measure(48.7) stats.measure(32.5) stats.measure(15.9) self.assertEqual(format_stats(stats.get(), 'short'), ('Runtime (in ms):\n' ' mean: 30.125 ± 13.839\n' ' min/max: 15.900 → 48.700\n' 'Percentile:\n' ' 50: 23.400 ± 14.121 (stdev)\n' ' 95: 48.700\n' ' 99.9: 48.700'))
def test_short_result_output_with_more_measurements(self): stats = Stats(4) stats.measure(23.4) stats.measure(48.7) stats.measure(32.5) stats.measure(15.9) self.assertEqual( format_stats(stats.get(), 'short'), ('Runtime (in ms):\n' ' mean: 30.125 ± 13.839\n' ' min/max: 15.900 → 48.700\n' 'Percentile:\n' ' 50: 23.400 ± 14.121 (stdev)\n' ' 95: 48.700\n' ' 99.9: 48.700') )