File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -810,6 +810,7 @@ def test_it_retrieves_unstored_refs_via_urlopen(self):
810
810
def test_it_can_construct_a_base_uri_from_a_schema (self ):
811
811
schema = {"id" : "foo" }
812
812
resolver = RefResolver .from_schema (schema )
813
+ self .assertEqual (resolver .base_uri , "foo" )
813
814
self .assertEqual (resolver .resolution_scope , "foo" )
814
815
with resolver .resolving ("" ) as resolved :
815
816
self .assertEqual (resolved , schema )
@@ -823,6 +824,7 @@ def test_it_can_construct_a_base_uri_from_a_schema(self):
823
824
def test_it_can_construct_a_base_uri_from_a_schema_without_id (self ):
824
825
schema = {}
825
826
resolver = RefResolver .from_schema (schema )
827
+ self .assertEqual (resolver .base_uri , "" )
826
828
self .assertEqual (resolver .resolution_scope , "" )
827
829
with resolver .resolving ("" ) as resolved :
828
830
self .assertEqual (resolved , schema )
Original file line number Diff line number Diff line change @@ -288,6 +288,11 @@ def pop_scope(self):
288
288
def resolution_scope (self ):
289
289
return self ._scopes_stack [- 1 ]
290
290
291
+ # backwards compatibility
292
+ @property
293
+ def base_uri (self ):
294
+ uri , _ = urldefrag (self .resolution_scope )
295
+ return uri
291
296
292
297
# Deprecated, this function is no longer used, but is preserved for
293
298
# backwards compatibility
You can’t perform that action at this time.
0 commit comments