(tmpdir)
| 346 | |
| 347 | |
| 348 | def test_python_file_writelines(tmpdir): |
| 349 | lines = [b'line1\n', b'line2\n' b'line3'] |
| 350 | path = os.path.join(str(tmpdir), 'foo.txt') |
| 351 | with open(path, 'wb') as f: |
| 352 | try: |
| 353 | f = pa.PythonFile(f, mode='w') |
| 354 | assert f.writable() |
| 355 | f.writelines(lines) |
| 356 | finally: |
| 357 | f.close() |
| 358 | |
| 359 | with open(path, 'rb') as f: |
| 360 | try: |
| 361 | f = pa.PythonFile(f, mode='r') |
| 362 | assert f.readable() |
| 363 | assert f.read() == b''.join(lines) |
| 364 | finally: |
| 365 | f.close() |
| 366 | |
| 367 | |
| 368 | def test_python_file_closing(): |
nothing calls this directly
no test coverage detected