Example #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")
Example #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(), "")
Example #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")
Example #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***")
Example #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")