Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/dbetto/textdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ def __getitem__(self, item: str | Path) -> TextDB | AttrsDict | list | None:

# if directory, construct another TextDB object
if obj.is_dir():
db_ptr.__store__[item_id] = TextDB(obj, lazy=self.__lazy__)
db_ptr.__store__[item_id] = TextDB(
obj, lazy=self.__lazy__, hidden=self.__hidden__
)

else:
# try to attach an extension if file cannot be found
Expand Down
14 changes: 14 additions & 0 deletions tests/test_textdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,17 @@ def test_lazyness():
"file2",
"file3",
]


def test_hidden():
jdb = TextDB(testdb, hidden=True, lazy=False)
assert getattr(jdb, "__hidden__", False) is True

assert isinstance(jdb.dir1, TextDB)
assert getattr(jdb.dir1, "__hidden__", False) is True

assert isinstance(jdb.dir1.dir2, TextDB)
assert getattr(jdb.dir1.dir2, "__hidden__", False) is True

assert isinstance(jdb.dir2, TextDB)
assert getattr(jdb.dir2, "__hidden__", False) is True