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)
| 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 | """ |
nothing calls this directly
no test coverage detected