Skip to content

Commit

Permalink
read fold name form Database.metadata to gaurantee the same structure…
Browse files Browse the repository at this point in the history
… in unittest
  • Loading branch information
Xiaohui Qu authored and matthewcarbone committed Feb 29, 2024
1 parent fa2ee76 commit f957053
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lightshow/_tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ def test_multiplicipty_writing(database_from_file, tmp_path):
write_unit_cells=True,
pbar=False,
)
metadata_fn = target / Path("00000002") / Path("metadata.json")
with open(metadata_fn) as f:
d_metadata = json.load(f)
assert "multiplicities" in d_metadata
i_site, n_multi = "2", 4
assert d_metadata["multiplicities"][i_site] == n_multi
for k, v in database_from_file.metadata.items():
metadata_fn = target / Path(k) / Path("metadata.json")
with open(metadata_fn) as f:
d_metadata = json.load(f)
prim_meta = v["primitive"]
for i_site, n_multi in zip(
prim_meta["sites"], prim_meta["multiplicities"]
):
i_site = str(i_site)
assert "multiplicities" in d_metadata
assert d_metadata["multiplicities"][i_site] == n_multi

0 comments on commit f957053

Please sign in to comment.