Skip to content

Commit 1c8ba2f

Browse files
committed
test: update fs tests
1 parent 68a0c0b commit 1c8ba2f

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

tests/test_filesystem.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
NODE_ID = "0fPFklV3"
1313
FIND_NODE_ID = "0fPFklV3"
1414
DELETED_NODE_IDS = "t8HkzBH2", "8EwHVJna"
15+
TEST_FS = Path(__file__).parent / "fake_fs.json"
1516

1617

1718
@pytest.fixture(name="fs")
@@ -118,17 +119,14 @@ def get_path(recursive: bool) -> list[str]:
118119
assert get_path(recursive=True) == sorted(recursive_children)
119120

120121

121-
def test_unsafe_filesystem() -> None:
122-
path = Path(__file__).parent / "fake_fs.json"
123-
dump = json.loads(path.read_text())
122+
def test_unsafe_filesystem_build() -> None:
123+
dump = json.loads(TEST_FS.read_text())
124124
nodes = (Node.from_dump(node) for node in dump["nodes"].values())
125-
fs = UserFileSystem.build_unsafe(nodes)
126-
assert fs.dump() == dump
125+
UserFileSystem.build_unsafe(nodes)
127126

128127

129-
def test_safe_filesystem() -> None:
130-
path = Path(__file__).parent / "fake_fs.json"
131-
dump = json.loads(path.read_text())
128+
def test_safe_filesystem_build() -> None:
129+
dump = json.loads(TEST_FS.read_text())
132130
nodes = (Node.from_dump(node) for node in dump["nodes"].values())
133131
fs = UserFileSystem.build(nodes)
134-
path.write_text(json.dumps(fs.dump(), indent=2, ensure_ascii=False))
132+
TEST_FS.write_text(json.dumps(fs.dump(), indent=2, ensure_ascii=False) + "\n")

0 commit comments

Comments
 (0)