def test_readlog(self): s = BytesIO(b"foobar\nfoobar") s = tcp.Reader(s) assert not s.is_logging() s.start_log() assert s.is_logging() s.readline() assert s.get_log() == b"foobar\n" s.read(1) assert s.get_log() == b"foobar\nf" s.start_log() assert s.get_log() == b"" s.read(1) assert s.get_log() == b"o" s.stop_log() tutils.raises(ValueError, s.get_log)