def test_log(mocker, stdout_mock): cli.log('msg') cli.log('msg', indent=1) cli.log('{0} + 1', 2) cli.log('{0} + 1', 2, noformat=True) stdout_mock.assert_has_calls([ mocker.call('msg\n'), mocker.call(' msg\n'), mocker.call('2 + 1\n'), mocker.call('{0} + 1\n'), ]) assert stdout_mock.call_count == 4
def test_log(self, stdout_mock): cli.log('msg') cli.log('msg', indent=1) cli.log('{0} + 1', 2) cli.log('{0} + 1', 2, noformat=True) stdout_mock.assert_has_calls([ mock.call('msg\n'), mock.call(' msg\n'), mock.call('2 + 1\n'), mock.call('{0} + 1\n'), ]) self.assertEqual(stdout_mock.call_count, 4)