MCPcopy
hub / github.com/psf/black / test_cache_file_length

Method test_cache_file_length

tests/test_black.py:2188–2210  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2186 assert get_cache_dir().parent == workspace2
2187
2188 def test_cache_file_length(self) -> None:
2189 cases = [
2190 DEFAULT_MODE,
2191 # all of the target versions
2192 Mode(target_versions=set(TargetVersion)),
2193 # all of the features
2194 Mode(enabled_features=set(Preview)),
2195 # all of the magics
2196 Mode(python_cell_magics={f"magic{i}" for i in range(500)}),
2197 # all of the things
2198 Mode(
2199 target_versions=set(TargetVersion),
2200 enabled_features=set(Preview),
2201 python_cell_magics={f"magic{i}" for i in range(500)},
2202 ),
2203 ]
2204 for case in cases:
2205 cache_file = get_cache_file(case)
2206 # Some common file systems enforce a maximum path length
2207 # of 143 (issue #4174). We can't do anything if the directory
2208 # path is too long, but ensure the name of the cache file itself
2209 # doesn't get too crazy.
2210 assert len(cache_file.name) <= 96
2211
2212 def test_cache_file_path_ignores_python_cell_magic_separators(self) -> None:
2213 mode = replace(DEFAULT_MODE, python_cell_magics={"../../../tmp/pwned"})

Callers

nothing calls this directly

Calls 2

ModeClass · 0.90
get_cache_fileFunction · 0.90

Tested by

no test coverage detected