(self)
| 247 | self.assertEqual(ostream.getvalue(), self.tstring[1]) |
| 248 | |
| 249 | def test_streamwriter(self): |
| 250 | readfuncs = ('read', 'readline', 'readlines') |
| 251 | UTF8Reader = codecs.getreader('utf-8') |
| 252 | for name in readfuncs: |
| 253 | for sizehint in [None] + list(range(1, 33)) + \ |
| 254 | [64, 128, 256, 512, 1024]: |
| 255 | istream = UTF8Reader(BytesIO(self.tstring[1])) |
| 256 | ostream = self.writer(BytesIO()) |
| 257 | func = getattr(istream, name) |
| 258 | while 1: |
| 259 | if sizehint is not None: |
| 260 | data = func(sizehint) |
| 261 | else: |
| 262 | data = func() |
| 263 | |
| 264 | if not data: |
| 265 | break |
| 266 | if name == "readlines": |
| 267 | ostream.writelines(data) |
| 268 | else: |
| 269 | ostream.write(data) |
| 270 | |
| 271 | self.assertEqual(ostream.getvalue(), self.tstring[0]) |
| 272 | |
| 273 | def test_streamwriter_reset_no_pending(self): |
| 274 | # Issue #23247: Calling reset() on a fresh StreamWriter instance |
nothing calls this directly
no test coverage detected