def test_close(self): stdout = Stdout() stdout.write(b'foo') stdout.write(b'barbaz') stdout.close() assert_equal(12, stdout.duration)
def test_write(self): timing = [] stdout = Stdout(timing) stdout.write(b'foo') stdout.write(b'barbaz') assert_equal(b'foobarbaz', stdout.data) assert_equal([[2, 3], [7, 6]], timing)
def test_write(self): stdout = Stdout() stdout.write(b'foo') stdout.write(b'barbaz') stdout.write('żó'.encode('utf-8') + bytes([0xc5])) stdout.write(bytes([0x82]) + 'ć'.encode('utf-8')) assert_equal([[2, 'foo'], [7, 'barbaz'], [3, 'żó'], [4, 'łć']], stdout.frames)