@@ -100,10 +100,12 @@ def test_traversable(tmp_path):
100100 "$schema" : "https://json-schema.org/draft/2020-12/schema" ,
101101 "$id" : "http://example.com/" ,
102102 }
103+ subpath , subschema = schemas / "more/child.json" , {"foo" : "bar" }
103104
104- schemas .mkdir (parents = True )
105+ schemas .joinpath ( "more" ). mkdir (parents = True )
105106 package .joinpath ("__init__.py" ).touch ()
106107 path .write_text (json .dumps (schema ))
108+ subpath .write_text (json .dumps (subschema ))
107109
108110 # ?!?! -- without this, importlib.resources.files fails on 3.9 and no other
109111 # version!?!?
@@ -114,13 +116,14 @@ def test_traversable(tmp_path):
114116 resources = loaders .from_traversable (files ("foo.schemas" ))
115117 registry = EMPTY_REGISTRY .with_resources (resources )
116118
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+ ]
124125 )
126+
127+ assert registry .crawl () == expected .crawl ()
125128 finally :
126129 sys .path .pop ()
0 commit comments