MCPcopy
hub / github.com/pytest-dev/pytest / test_unicode_idval_with_config

Method test_unicode_idval_with_config

testing/python/metafunc.py:372–399  ·  view source on GitHub ↗

Unit test for expected behavior to obtain ids with disable_test_id_escaping_and_forfeit_all_rights_to_community_support option (#5294).

(self)

Source from the content-addressed store, hash-verified

370 )
371
372 def test_unicode_idval_with_config(self) -> None:
373 """Unit test for expected behavior to obtain ids with
374 disable_test_id_escaping_and_forfeit_all_rights_to_community_support
375 option (#5294)."""
376
377 class MockConfig:
378 def __init__(self, config):
379 self.config = config
380
381 @property
382 def hook(self):
383 return self
384
385 def pytest_make_parametrize_id(self, **kw):
386 pass
387
388 def getini(self, name):
389 return self.config[name]
390
391 option = "disable_test_id_escaping_and_forfeit_all_rights_to_community_support"
392
393 values: list[tuple[str, Any, str]] = [
394 ("ação", MockConfig({option: True}), "ação"),
395 ("ação", MockConfig({option: False}), "a\\xe7\\xe3o"),
396 ]
397 for val, config, expected in values:
398 actual = IdMaker([], [], None, None, config, None)._idval(val, "a", 6)
399 assert actual == expected
400
401 def test_bytes_idval(self) -> None:
402 """Unit test for the expected behavior to obtain ids for parametrized

Callers

nothing calls this directly

Calls 3

IdMakerClass · 0.90
MockConfigClass · 0.85
_idvalMethod · 0.80

Tested by

no test coverage detected