MCPcopy Index your code
hub / github.com/python/cpython / test_encoding_warnings

Method test_encoding_warnings

Lib/test/test_zipfile/_path/test_path.py:191–200  ·  view source on GitHub ↗

EncodingWarning must blame the read_text and open calls.

(self, alpharep)

Source from the content-addressed store, hash-verified

189 )
190 @pass_alpharep
191 def test_encoding_warnings(self, alpharep):
192 """EncodingWarning must blame the read_text and open calls."""
193 assert sys.flags.warn_default_encoding
194 root = zipfile.Path(alpharep)
195 with self.assertWarns(EncodingWarning) as wc: # noqa: F821 (astral-sh/ruff#13296)
196 root.joinpath("a.txt").read_text()
197 assert __file__ == wc.filename
198 with self.assertWarns(EncodingWarning) as wc: # noqa: F821 (astral-sh/ruff#13296)
199 root.joinpath("a.txt").open("r").close()
200 assert __file__ == wc.filename
201
202 def test_open_write(self):
203 """

Callers

nothing calls this directly

Calls 5

joinpathMethod · 0.95
assertWarnsMethod · 0.80
read_textMethod · 0.45
closeMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected