Unit test for expected behavior to obtain ids with disable_test_id_escaping_and_forfeit_all_rights_to_community_support option (#5294).
(self)
| 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 |
| 315 | disable_test_id_escaping_and_forfeit_all_rights_to_community_support |
| 316 | option (#5294).""" |
| 317 | |
| 318 | class MockConfig: |
| 319 | def __init__(self, config): |
| 320 | self.config = config |
| 321 | |
| 322 | @property |
| 323 | def hook(self): |
| 324 | return self |
| 325 | |
| 326 | def pytest_make_parametrize_id(self, **kw): |
| 327 | pass |
| 328 | |
| 329 | def getini(self, name): |
| 330 | return self.config[name] |
| 331 | |
| 332 | option = "disable_test_id_escaping_and_forfeit_all_rights_to_community_support" |
| 333 | |
| 334 | values: List[Tuple[str, Any, str]] = [ |
| 335 | ("ação", MockConfig({option: True}), "ação"), |
| 336 | ("ação", MockConfig({option: False}), "a\\xe7\\xe3o"), |
| 337 | ] |
| 338 | for val, config, expected in values: |
| 339 | actual = _idval(val, "a", 6, None, nodeid=None, config=config) |
| 340 | assert actual == expected |
| 341 | |
| 342 | def test_bytes_idval(self) -> None: |
| 343 | """Unit test for the expected behavior to obtain ids for parametrized |
nothing calls this directly
no test coverage detected