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

Method test_idmaker_with_ids_and_config

testing/python/metafunc.py:531–564  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

529 assert result == [expected]
530
531 def test_idmaker_with_ids_and_config(self) -> None:
532 """Unit test for expected behavior to create ids with ids and
533 disable_test_id_escaping_and_forfeit_all_rights_to_community_support
534 option (#5294).
535 """
536
537 class MockConfig:
538 def __init__(self, config):
539 self.config = config
540
541 @property
542 def hook(self):
543 return self
544
545 def pytest_make_parametrize_id(self, **kw):
546 pass
547
548 def getini(self, name):
549 return self.config[name]
550
551 option = "disable_test_id_escaping_and_forfeit_all_rights_to_community_support"
552
553 values: List[Tuple[Any, str]] = [
554 (MockConfig({option: True}), "ação"),
555 (MockConfig({option: False}), "a\\xe7\\xe3o"),
556 ]
557 for config, expected in values:
558 result = idmaker(
559 ("a",),
560 [pytest.param("string")],
561 ids=["ação"],
562 config=config,
563 )
564 assert result == [expected]
565
566 def test_parametrize_ids_exception(self, pytester: Pytester) -> None:
567 """

Callers

nothing calls this directly

Calls 3

idmakerFunction · 0.90
MockConfigClass · 0.85
paramMethod · 0.80

Tested by

no test coverage detected