File: test_1539.py

package info (click to toggle)
python-asdf 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,032 kB
  • sloc: python: 24,068; makefile: 123
file content (22 lines) | stat: -rw-r--r-- 518 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import io

import pytest

import asdf


@pytest.mark.xfail(reason="Fix will require more major changes to generic_io")
def test_invalid_seek_and_read_from_closed_memoryio():
    """
    Seek and read from closed MemoryIO

    https://github.com/asdf-format/asdf/issues/1539
    """
    b = io.BytesIO()
    b.write(b"\0" * 10)
    b.seek(0)
    f = asdf.generic_io.get_file(b)
    f.close()
    with pytest.raises(IOError, match="I/O operation on closed file."):
        f.read_into_array(10)
    assert b.tell() == 0