1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-04-13 15:58:21 +00:00
nix-darwin/modules/system/files/linker/tests/test_only_empty.py
2024-12-31 23:00:13 +00:00

22 lines
689 B
Python

from linker import only_empty
from .mock_path import MockPath
def test_no_enclosing_directories():
assert only_empty([]) == []
def test_one_empty_dir():
empty_dir = MockPath("empty_dir")
empty_dir.contents = []
assert only_empty([empty_dir]) == [empty_dir]
def test_one_full_dir():
full_dir = MockPath("full_dir")
full_dir.contents = [MockPath("file_in_dir"), MockPath("another_file_in_dir")]
assert only_empty([full_dir]) == []
def test_mix():
empty_dir = MockPath("empty_dir")
empty_dir.contents = []
full_dir = MockPath("full_dir")
full_dir.contents = [MockPath("file_in_dir")]
assert only_empty([empty_dir, full_dir]) == [empty_dir]