示例#1
0
 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")
示例#2
0
 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(), "")
示例#3
0
 def test_trace_2(self):
     with Patched('stdout') as mock_stdout:
         zz.trace(CustomStr(), None)
         self.assertEqual(mock_stdout.getvalue(), str(CustomStr()) + "\n")
示例#4
0
 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***")
示例#5
0
 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")