Home | History | Annotate | Download | only in test

Lines Matching refs:txt

2219             txt = self.TextIOWrapper(buf, encoding="ascii", newline=newline)
2220 self.assertEqual(txt.readlines(), expected)
2221 txt.seek(0)
2222 self.assertEqual(txt.read(), "".join(expected))
2234 txt = self.TextIOWrapper(buf, encoding="ascii", newline=newline)
2235 txt.write("AAA\nB")
2236 txt.write("BB\nCCC\n")
2237 txt.write("X\rY\r\nZ")
2238 txt.flush()
2468 txt = self.TextIOWrapper(UnReadable())
2469 self.assertRaises(IOError, txt.read)
2472 txt = self.TextIOWrapper(self.BytesIO(b"AA\r\nBB"))
2475 c = txt.read(1)
2482 txt = self.TextIOWrapper(self.BytesIO(b"AA\nBB\nCC"))
2483 self.assertEqual(txt.readlines(), ["AA\n", "BB\n", "CC"])
2484 txt.seek(0)
2485 self.assertEqual(txt.readlines(None), ["AA\n", "BB\n", "CC"])
2486 txt.seek(0)
2487 self.assertEqual(txt.readlines(5), ["AA\n", "BB\n"])
2492 txt = self.TextIOWrapper(self.BytesIO(b"A" * 127 + b"\r\nB"))
2495 c = txt.read(128)
2504 txt = self.TextIOWrapper(buf)
2505 txt.writelines(l)
2506 txt.flush()
2512 txt = self.TextIOWrapper(buf)
2513 txt.writelines(l)
2514 txt.flush()
2518 txt = self.TextIOWrapper(self.BytesIO())
2519 self.assertRaises(TypeError, txt.writelines, [1, 2, 3])
2520 self.assertRaises(TypeError, txt.writelines, None)
2521 self.assertRaises(TypeError, txt.writelines, b'abc')
2524 txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii")
2529 c = txt.read(1)
2536 txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii")
2537 txt._CHUNK_SIZE = 4
2541 c = txt.read(4)
2548 txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii")
2549 txt._CHUNK_SIZE = 4
2551 reads = txt.read(4)
2552 reads += txt.read(4)
2553 reads += txt.readline()
2554 reads += txt.readline()
2555 reads += txt.readline()
2559 txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii")
2560 txt._CHUNK_SIZE = 4
2562 reads = txt.read(4)
2563 reads += txt.read()
2567 txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii")
2568 txt._CHUNK_SIZE = 4
2570 reads = txt.read(4)
2571 pos = txt.tell()
2572 txt.seek(0)
2573 txt.seek(pos)
2574 self.assertEqual(txt.read(4), "BBB\n")
2578 txt = self.TextIOWrapper(buffer, encoding="ascii")
2580 self.assertEqual(buffer.seekable(), txt.seekable())
2639 txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii")
2642 closed[:] = [txt.closed, txt.buffer.closed]
2644 txt.flush = bad_flush
2645 self.assertRaises(IOError, txt.close) # exception not swallowed
2646 self.assertTrue(txt.closed)
2647 self.assertTrue(txt.buffer.closed)
2651 txt.flush = lambda: None # break reference loop
2654 txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii")
2655 txt.close()
2656 txt.close()
2657 txt.close()
2658 self.assertRaises(ValueError, txt.flush)
2661 txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii")
2664 txt.buffer = buf