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

Method test_idmaker_with_ids_and_config

testing/python/metafunc.py:630–660  ·  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

628 assert result == [expected]
629
630 def test_idmaker_with_ids_and_config(self) -> None:
631 """Unit test for expected behavior to create ids with ids and
632 disable_test_id_escaping_and_forfeit_all_rights_to_community_support
633 option (#5294).
634 """
635
636 class MockConfig:
637 def __init__(self, config):
638 self.config = config
639
640 @property
641 def hook(self):
642 return self
643
644 def pytest_make_parametrize_id(self, **kw):
645 pass
646
647 def getini(self, name):
648 return self.config[name]
649
650 option = "disable_test_id_escaping_and_forfeit_all_rights_to_community_support"
651
652 values: list[tuple[Any, str]] = [
653 (MockConfig({option: True}), "ação"),
654 (MockConfig({option: False}), "a\\xe7\\xe3o"),
655 ]
656 for config, expected in values:
657 result = IdMaker(
658 ("a",), [pytest.param("string")], None, ["ação"], config, None
659 ).make_unique_parameterset_ids()
660 assert result == [expected]
661
662 def test_idmaker_with_param_id_and_config(self) -> None:
663 """Unit test for expected behavior to create ids with pytest.param(id=...) and

Callers

nothing calls this directly

Calls 4

IdMakerClass · 0.90
MockConfigClass · 0.85
paramMethod · 0.80

Tested by

no test coverage detected