@@ -100,10 +100,12 @@ def test_traversable(tmp_path):
100
100
"$schema" : "https://json-schema.org/draft/2020-12/schema" ,
101
101
"$id" : "http://example.com/" ,
102
102
}
103
+ subpath , subschema = schemas / "more/child.json" , {"foo" : "bar" }
103
104
104
- schemas .mkdir (parents = True )
105
+ schemas .joinpath ( "more" ). mkdir (parents = True )
105
106
package .joinpath ("__init__.py" ).touch ()
106
107
path .write_text (json .dumps (schema ))
108
+ subpath .write_text (json .dumps (subschema ))
107
109
108
110
# ?!?! -- without this, importlib.resources.files fails on 3.9 and no other
109
111
# version!?!?
@@ -114,13 +116,14 @@ def test_traversable(tmp_path):
114
116
resources = loaders .from_traversable (files ("foo.schemas" ))
115
117
registry = EMPTY_REGISTRY .with_resources (resources )
116
118
117
- assert (
118
- registry .crawl ()
119
- == Registry ()
120
- .with_contents (
121
- [(path .as_uri (), schema )],
122
- )
123
- .crawl ()
119
+ expected = Registry ().with_resources (
120
+ (each , DRAFT202012 .create_resource (contents ))
121
+ for each , contents in [
122
+ (path .as_uri (), schema ),
123
+ (subpath .as_uri (), subschema ),
124
+ ]
124
125
)
126
+
127
+ assert registry .crawl () == expected .crawl ()
125
128
finally :
126
129
sys .path .pop ()
0 commit comments