(self)
| 2481 | assert two.is_changed(path) |
| 2482 | |
| 2483 | def test_cache_key(self) -> None: |
| 2484 | # Test that all members of the mode enum affect the cache key. |
| 2485 | for field in fields(Mode): |
| 2486 | values: list[Any] |
| 2487 | if field.name == "target_versions": |
| 2488 | values = [ |
| 2489 | {TargetVersion.PY312}, |
| 2490 | {TargetVersion.PY313}, |
| 2491 | ] |
| 2492 | elif field.name == "python_cell_magics": |
| 2493 | values = [{"magic1"}, {"magic2"}] |
| 2494 | elif field.name == "enabled_features": |
| 2495 | # If you are looking to remove one of these features, just |
| 2496 | # replace it with any other feature. |
| 2497 | values = [ |
| 2498 | {Preview.wrap_comprehension_in}, |
| 2499 | {Preview.string_processing}, |
| 2500 | ] |
| 2501 | elif field.type is bool: |
| 2502 | values = [True, False] |
| 2503 | elif field.type is int: |
| 2504 | values = [1, 2] |
| 2505 | else: |
| 2506 | raise AssertionError( |
| 2507 | f"Unhandled field type: {field.type} for field {field.name}" |
| 2508 | ) |
| 2509 | modes = [replace(DEFAULT_MODE, **{field.name: value}) for value in values] |
| 2510 | keys = [mode.get_cache_key() for mode in modes] |
| 2511 | assert len(set(keys)) == len(modes) |
| 2512 | |
| 2513 | |
| 2514 | def assert_collected_sources( |
nothing calls this directly
no test coverage detected