def test_multi_record(self):
     results = {"r1": {"a": 2, "b": 4}, "r2": {"a": 2}, "r3": {"b": 3}}
     expected = ("Called logging.debug('Total times taken by modules')\n"
                 "Called logging.debug('  %s: %.1fs', 'a', 4.0)\n"
                 "Called logging.debug('  %s: %.1fs', 'b', 7.0)\n")
     main.log_module_runtimes(results)
     assert_same_trace(self.trace_tracker, expected)
示例#2
0
 def test_multi_record(self, mocked_logging):
     results = {"r1": {"a": 2, "b": 4}, "r2": {"a": 2}, "r3": {"b": 3}}
     main.log_module_runtimes(results)
     assert mocked_logging.call_count == 3
     expected = [
         call('Total times taken by modules',),
         call('  %s: %.1fs', 'a', 4.0),
         call('  %s: %.1fs', 'b', 7.0),
     ]
     assert mocked_logging.call_args_list == expected
示例#3
0
 def test_nothing_to_report(self, mocked_logging):
     results = {"r1": {}}
     main.log_module_runtimes(results)
     mocked_logging.assert_not_called()
 def test_nothing_to_report(self):
     results = {"r1": {}}
     main.log_module_runtimes(results)
     assert_same_trace(self.trace_tracker, "")