MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_unicode_idval

Method test_unicode_idval

testing/python/metafunc.py:293–311  ·  view source on GitHub ↗

Test that Unicode strings outside the ASCII character set get escaped, using byte escapes if they're in that range or unicode escapes if they're not.

(self)

Source from the content-addressed store, hash-verified

291 escaped.encode("ascii")
292
293 def test_unicode_idval(self) -> None:
294 """Test that Unicode strings outside the ASCII character set get
295 escaped, using byte escapes if they're in that range or unicode
296 escapes if they're not.
297
298 """
299 values = [
300 ("", r""),
301 ("ascii", r"ascii"),
302 ("ação", r"a\xe7\xe3o"),
303 ("josé@blah.com", r"jos\xe9@blah.com"),
304 (
305 r"δοκ.ιμή@παράδειγμα.δοκιμή",
306 r"\u03b4\u03bf\u03ba.\u03b9\u03bc\u03ae@\u03c0\u03b1\u03c1\u03ac\u03b4\u03b5\u03b9\u03b3"
307 r"\u03bc\u03b1.\u03b4\u03bf\u03ba\u03b9\u03bc\u03ae",
308 ),
309 ]
310 for val, expected in values:
311 assert _idval(val, "a", 6, None, nodeid=None, config=None) == expected
312
313 def test_unicode_idval_with_config(self) -> None:
314 """Unit test for expected behavior to obtain ids with

Callers

nothing calls this directly

Calls 1

_idvalFunction · 0.90

Tested by

no test coverage detected