MCPcopy Create free account
hub / github.com/numpy/numpy / test_file_is_closed_on_error

Method test_file_is_closed_on_error

numpy/lib/tests/test_io.py:1540–1551  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1538 assert_equal(test, control)
1539
1540 def test_file_is_closed_on_error(self):
1541 # gh-13200
1542 with tempdir() as tmpdir:
1543 fpath = os.path.join(tmpdir, "test.csv")
1544 with open(fpath, "wb") as f:
1545 f.write('\N{GREEK PI SYMBOL}'.encode())
1546
1547 # ResourceWarnings are emitted from a destructor, so won't be
1548 # detected by regular propagation to errors.
1549 with assert_no_warnings():
1550 with pytest.raises(UnicodeDecodeError):
1551 np.genfromtxt(fpath, encoding="ascii")
1552
1553 def test_autonames_and_usecols(self):
1554 # Tests names and usecols

Callers

nothing calls this directly

Calls 6

tempdirFunction · 0.90
assert_no_warningsFunction · 0.90
openFunction · 0.85
encodeMethod · 0.80
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected