def test_trace_5(self): with Patched('stdout'): self.assertEqual(zz.trace("foo", None), None) self.assertEqual(zz.trace("bar", 10), 10) self.assertEqual(zz.trace("baz", "STRING", end='\n\n\n'), "STRING")
def test_trace_4(self): stream = NullStream() with Patched('stdout') as mock_stdout: zz.trace("foo", None, file=stream) zz.trace("bar", None, file=stream) self.assertEqual(mock_stdout.getvalue(), "")
def test_trace_2(self): with Patched('stdout') as mock_stdout: zz.trace(CustomStr(), None) self.assertEqual(mock_stdout.getvalue(), str(CustomStr()) + "\n")
def test_trace_3(self): with Patched('stdout') as mock_stdout: zz.trace("foo", None, end='') zz.trace("bar", None, end='***') self.assertEqual(mock_stdout.getvalue(), "foobar***")
def test_trace_1(self): with Patched('stdout') as mock_stdout: zz.trace("foo", None) zz.trace("bar", None) zz.trace(900, None) self.assertEqual(mock_stdout.getvalue(), "foo\nbar\n900\n")