|
6 | 6 | import shutil |
7 | 7 | from typing import Any |
8 | 8 |
|
9 | | -from anys import ANY_AWARE_DATETIME, AnyFullmatch, AnyIn |
| 9 | +from anys import ANY_AWARE_DATETIME, ANY_INT, AnyFullmatch, AnyIn |
10 | 10 | from dandischema.consts import DANDI_SCHEMA_VERSION |
11 | 11 | from dandischema.metadata import validate |
12 | 12 | from dandischema.models import ( |
|
24 | 24 | SexType, |
25 | 25 | Software, |
26 | 26 | SpeciesType, |
27 | | - StrainType |
| 27 | + StrainType, |
28 | 28 | ) |
29 | 29 | from dandischema.models import Dandiset as DandisetMeta |
30 | 30 | from dateutil.tz import tzutc |
@@ -837,7 +837,8 @@ def test_ndtypes(ndtypes, asset_dict): |
837 | 837 | def test_nwb2asset(simple2_nwb: Path) -> None: |
838 | 838 | # Classes with ANY_AWARE_DATETIME fields need to be constructed with |
839 | 839 | # model_construct() |
840 | | - assert nwb2asset(simple2_nwb, digest=DUMMY_DANDI_ETAG) == BareAsset.model_construct( |
| 840 | + extracted = nwb2asset(simple2_nwb, digest=DUMMY_DANDI_ETAG) |
| 841 | + target = BareAsset.model_construct( |
841 | 842 | schemaKey="Asset", |
842 | 843 | schemaVersion=DANDI_SCHEMA_VERSION, |
843 | 844 | keywords=["keyword1", "keyword 2"], |
@@ -874,7 +875,7 @@ def test_nwb2asset(simple2_nwb: Path) -> None: |
874 | 875 | ], |
875 | 876 | ), |
876 | 877 | ], |
877 | | - contentSize=ByteSize(19664), |
| 878 | + contentSize=ANY_INT, |
878 | 879 | encodingFormat="application/x-nwb", |
879 | 880 | digest={DigestType.dandi_etag: "dddddddddddddddddddddddddddddddd-1"}, |
880 | 881 | path=str(simple2_nwb), |
@@ -907,6 +908,8 @@ def test_nwb2asset(simple2_nwb: Path) -> None: |
907 | 908 | approach=[], |
908 | 909 | relatedResource=[], |
909 | 910 | ) |
| 911 | + assert dict(extracted) == dict(target) # for easier comprehension of diffs |
| 912 | + assert extracted == target # for ultimate equality |
910 | 913 |
|
911 | 914 |
|
912 | 915 | @pytest.mark.xfail(reason="https://github.com/dandi/dandi-cli/issues/1450") |
|
0 commit comments