@@ -34,7 +34,7 @@ def test_binding_replace():
3434 g .bind ("foaf" , FOAF1 )
3535 g .bind ("foaf2" , FOAF2 )
3636 assert len (list (g .namespaces ())) == 2
37- assert list (g .namespaces ()) == [(' foaf' , foaf1_uri ), ("foaf2" , foaf2_uri )]
37+ assert list (g .namespaces ()) == [(" foaf" , foaf1_uri ), ("foaf2" , foaf2_uri )]
3838
3939 # Now you want to "upgrade" to FOAF2=>foaf and try the obvious:
4040 g .bind ("foaf" , FOAF2 )
@@ -61,7 +61,7 @@ def test_binding_replace():
6161
6262 assert list (g .namespaces ()) == [
6363 ("foaf" , foaf2_uri ), # Should be present but has been removed.
64- (' oldfoaf' , foaf1_uri ),
64+ (" oldfoaf" , foaf1_uri ),
6565 ]
6666
6767 # 2. Changing the prefix of an existing namespace=>prefix binding:
@@ -72,7 +72,7 @@ def test_binding_replace():
7272
7373 # Which, as things stand, results in:
7474
75- assert list (g .namespaces ()) == [("foaf" , foaf2_uri ), (' foaf1' , foaf1_uri )]
75+ assert list (g .namespaces ()) == [("foaf" , foaf2_uri ), (" foaf1" , foaf1_uri )]
7676
7777 # In which the attempted change from `oldfoaf` to (the already
7878 # bound-to-a different-namespace `foaf`) was intercepted and
@@ -82,13 +82,13 @@ def test_binding_replace():
8282 g .bind ("oldfoaf" , FOAF1 , replace = True )
8383
8484 # The bindings are again as desired
85- assert list (g .namespaces ()) == [("foaf" , foaf2_uri ), (' oldfoaf' , foaf1_uri )]
85+ assert list (g .namespaces ()) == [("foaf" , foaf2_uri ), (" oldfoaf" , foaf1_uri )]
8686
8787 # Next time through, set override to False
8888 g .bind ("foaf" , FOAF1 , override = False )
8989
9090 # And the bindings will remain as desired
91- assert list (g .namespaces ()) == [("foaf" , foaf2_uri ), (' oldfoaf' , foaf1_uri )]
91+ assert list (g .namespaces ()) == [("foaf" , foaf2_uri ), (" oldfoaf" , foaf1_uri )]
9292
9393 # 3. Parsing data with prefix=>namespace bindings
9494 # Let's see the situation regarding namespace bindings
@@ -108,7 +108,7 @@ def test_binding_replace():
108108 # non-clashing prefix of `foaf1` is rebound to FOAF1 in
109109 # place of the existing `oldfoaf` prefix
110110
111- assert list (g .namespaces ()) == [("foaf" , foaf2_uri ), (' foaf1' , foaf1_uri )]
111+ assert list (g .namespaces ()) == [("foaf" , foaf2_uri ), (" foaf1" , foaf1_uri )]
112112
113113 # Yes, namespace bindings in parsed data replace existing
114114 # bindings (i.e. `oldfoaf` was replaced by `foaf1`), just
@@ -128,7 +128,7 @@ def test_binding_replace():
128128 # by the `foaf2=>FOAF2` binding specified in the N3 source
129129
130130 assert list (g .namespaces ()) == [
131- (' foaf1' , foaf1_uri ),
131+ (" foaf1" , foaf1_uri ),
132132 ("foaf2" , foaf2_uri ),
133133 ]
134134
@@ -146,7 +146,7 @@ def test_binding_replace():
146146 # used
147147
148148 assert list (g .namespaces ()) == [
149- (' foaf1' , foaf1_uri ),
149+ (" foaf1" , foaf1_uri ),
150150 ("foaf2" , foaf2_uri ),
151151 ]
152152
@@ -161,7 +161,7 @@ def test_binding_replace():
161161
162162 assert list (g .namespaces ()) == [
163163 ("foaf2" , foaf2_uri ),
164- (' foaf' , foaf1_uri ),
164+ (" foaf" , foaf1_uri ),
165165 ]
166166
167167 # Prefixes are bound to namespaces which in turn have a URIRef
@@ -191,11 +191,11 @@ def test_prefix_alias_disallowed():
191191
192192 g = Graph (bind_namespaces = "none" )
193193 g .bind ("owl" , OWL )
194- assert (' owl' , URIRef (' http://www.w3.org/2002/07/owl#' )) in list (g .namespaces ())
194+ assert (" owl" , URIRef (" http://www.w3.org/2002/07/owl#" )) in list (g .namespaces ())
195195
196196 g .bind ("wol" , OWL , override = False )
197- assert (' owl' , URIRef (' http://www.w3.org/2002/07/owl#' )) in list (g .namespaces ())
198- assert (' wol' , URIRef (' http://www.w3.org/2002/07/owl#' )) not in list (g .namespaces ())
197+ assert (" owl" , URIRef (" http://www.w3.org/2002/07/owl#" )) in list (g .namespaces ())
198+ assert (" wol" , URIRef (" http://www.w3.org/2002/07/owl#" )) not in list (g .namespaces ())
199199
200200
201201def test_rebind_prefix_succeeds ():
@@ -204,11 +204,11 @@ def test_rebind_prefix_succeeds():
204204
205205 g = Graph (bind_namespaces = "none" )
206206 g .bind ("owl" , OWL )
207- assert (' owl' , URIRef (' http://www.w3.org/2002/07/owl#' )) in list (g .namespaces ())
207+ assert (" owl" , URIRef (" http://www.w3.org/2002/07/owl#" )) in list (g .namespaces ())
208208
209209 g .bind ("wol" , OWL )
210- assert (' wol' , URIRef (' http://www.w3.org/2002/07/owl#' )) in list (g .namespaces ())
211- assert (' owl' , URIRef (' http://www.w3.org/2002/07/owl#' )) not in list (g .namespaces ())
210+ assert (" wol" , URIRef (" http://www.w3.org/2002/07/owl#" )) in list (g .namespaces ())
211+ assert (" owl" , URIRef (" http://www.w3.org/2002/07/owl#" )) not in list (g .namespaces ())
212212
213213
214214def test_parse_rebinds_prefix ():
@@ -223,14 +223,14 @@ def test_parse_rebinds_prefix():
223223
224224 # Use full set of namespace bindings, including foaf
225225 g = Graph (bind_namespaces = "none" )
226- g .bind (' foaf' , FOAF1 )
227- assert (' foaf' , foaf1_uri ) in list (g .namespaces ())
226+ g .bind (" foaf" , FOAF1 )
227+ assert (" foaf" , foaf1_uri ) in list (g .namespaces ())
228228
229229 g .parse (data = data , format = "n3" )
230230
231231 # foaf no longer in set of namespace bindings
232- assert (' foaf' , foaf1_uri ) not in list (g .namespaces ())
233- assert (' friend-of-a-friend' , foaf1_uri ) in list (g .namespaces ())
232+ assert (" foaf" , foaf1_uri ) not in list (g .namespaces ())
233+ assert (" friend-of-a-friend" , foaf1_uri ) in list (g .namespaces ())
234234
235235
236236@pytest .mark .xfail (
@@ -254,7 +254,7 @@ def test_automatic_handling_of_unknown_predicates():
254254
255255 g = Graph (bind_namespaces = "none" )
256256
257- g .add ((tarek , URIRef (' http://xmlns.com/foaf/0.1/name' ), Literal ("Tarek" )))
257+ g .add ((tarek , URIRef (" http://xmlns.com/foaf/0.1/name" ), Literal ("Tarek" )))
258258
259259 assert len (list (g .namespaces ())) > 0
260260
@@ -263,7 +263,7 @@ def test_automatic_handling_of_unknown_predicates_only_effected_after_serializat
263263
264264 g = Graph (bind_namespaces = "none" )
265265
266- g .add ((tarek , URIRef (' http://xmlns.com/foaf/0.1/name' ), Literal ("Tarek" )))
266+ g .add ((tarek , URIRef (" http://xmlns.com/foaf/0.1/name" ), Literal ("Tarek" )))
267267
268268 assert "@prefix ns1: <http://xmlns.com/foaf/0.1/> ." in g .serialize (format = "n3" )
269269
@@ -282,27 +282,27 @@ def test_multigraph_bindings():
282282
283283 g1 = Graph (store , identifier = context1 , bind_namespaces = "none" )
284284
285- g1 .bind (' foaf' , FOAF1 )
286- assert list (g1 .namespaces ()) == [(' foaf' , foaf1_uri )]
287- assert list (store .namespaces ()) == [(' foaf' , foaf1_uri )]
285+ g1 .bind (" foaf" , FOAF1 )
286+ assert list (g1 .namespaces ()) == [(" foaf" , foaf1_uri )]
287+ assert list (store .namespaces ()) == [(" foaf" , foaf1_uri )]
288288
289289 g1 .add ((tarek , FOAF1 .name , Literal ("tarek" )))
290290
291- assert list (store .namespaces ()) == [(' foaf' , foaf1_uri )]
291+ assert list (store .namespaces ()) == [(" foaf" , foaf1_uri )]
292292
293293 g2 = Graph (store , identifier = context2 , bind_namespaces = "none" )
294294 g2 .parse (data = data , format = "n3" )
295295
296296 # The parser-caused rebind is in the underlying store and all objects
297297 # that use the store see the changed binding:
298- assert list (store .namespaces ()) == [(' friend-of-a-friend' , foaf1_uri )]
299- assert list (g1 .namespaces ()) == [(' friend-of-a-friend' , foaf1_uri )]
298+ assert list (store .namespaces ()) == [(" friend-of-a-friend" , foaf1_uri )]
299+ assert list (g1 .namespaces ()) == [(" friend-of-a-friend" , foaf1_uri )]
300300
301301 # Including newly-created objects that use the store
302302 cg = ConjunctiveGraph (store = store )
303303
304- assert (' foaf' , foaf1_uri ) not in list (cg .namespaces ())
305- assert (' friend-of-a-friend' , foaf1_uri ) in list (cg .namespaces ())
304+ assert (" foaf" , foaf1_uri ) not in list (cg .namespaces ())
305+ assert (" friend-of-a-friend" , foaf1_uri ) in list (cg .namespaces ())
306306
307307 assert len (list (g1 .namespaces ())) == 6
308308 assert len (list (g2 .namespaces ())) == 6
@@ -324,24 +324,24 @@ def test_multigraph_bindings():
324324
325325 # Add foaf2 binding if not already bound
326326 cg .bind ("foaf2" , FOAF2 , override = False )
327- assert (' foaf2' , foaf2_uri ) in list (cg .namespaces ())
327+ assert (" foaf2" , foaf2_uri ) in list (cg .namespaces ())
328328
329329 # Impose foaf binding ... if not already bound
330330 cg .bind ("foaf" , FOAF1 , override = False )
331- assert (' foaf' , foaf1_uri ) not in list (cg .namespaces ())
331+ assert (" foaf" , foaf1_uri ) not in list (cg .namespaces ())
332332
333333
334334def test_new_namespace_new_prefix ():
335335 g = Graph (bind_namespaces = "none" )
336336 g .bind ("foaf" , FOAF1 )
337- assert list (g .namespaces ()) == [(' foaf' , foaf1_uri )]
337+ assert list (g .namespaces ()) == [(" foaf" , foaf1_uri )]
338338
339339
340340def test_change_prefix_override_true ():
341341 g = Graph (bind_namespaces = "none" )
342342
343343 g .bind ("foaf" , FOAF1 )
344- assert list (g .namespaces ()) == [(' foaf' , foaf1_uri )]
344+ assert list (g .namespaces ()) == [(" foaf" , foaf1_uri )]
345345
346346 g .bind ("oldfoaf" , FOAF1 )
347347 # Changed
@@ -352,7 +352,7 @@ def test_change_prefix_override_false():
352352 g = Graph (bind_namespaces = "none" )
353353
354354 g .bind ("foaf" , FOAF1 )
355- assert list (g .namespaces ()) == [(' foaf' , foaf1_uri )]
355+ assert list (g .namespaces ()) == [(" foaf" , foaf1_uri )]
356356
357357 g .bind ("oldfoaf" , FOAF1 , override = False )
358358 # No change
@@ -363,7 +363,7 @@ def test_change_namespace_override_true():
363363 g = Graph (bind_namespaces = "none" )
364364
365365 g .bind ("foaf" , FOAF1 )
366- assert list (g .namespaces ()) == [(' foaf' , foaf1_uri )]
366+ assert list (g .namespaces ()) == [(" foaf" , foaf1_uri )]
367367
368368 g .bind ("foaf" , FOAF2 )
369369 # Different prefix used
@@ -374,7 +374,7 @@ def test_change_namespace_override_false():
374374 g = Graph (bind_namespaces = "none" )
375375
376376 g .bind ("foaf" , FOAF1 )
377- assert list (g .namespaces ()) == [(' foaf' , foaf1_uri )]
377+ assert list (g .namespaces ()) == [(" foaf" , foaf1_uri )]
378378
379379 # Different namespace so override is irrelevant in this case
380380 g .bind ("foaf" , FOAF2 , override = False )
@@ -386,14 +386,14 @@ def test_new_namespace_override_false():
386386 g = Graph (bind_namespaces = "none" )
387387
388388 g .bind ("foaf" , FOAF2 )
389- assert list (g .namespaces ()) == [(' foaf' , foaf2_uri )]
389+ assert list (g .namespaces ()) == [(" foaf" , foaf2_uri )]
390390
391391 # Namespace not already bound so override is irrelevant in this case
392392 g .bind ("owl" , OWL , override = False )
393393 # Given prefix used
394394 assert list (g .namespaces ()) == [
395395 ("foaf" , foaf2_uri ),
396- (' owl' , URIRef (' http://www.w3.org/2002/07/owl#' )),
396+ (" owl" , URIRef (" http://www.w3.org/2002/07/owl#" )),
397397 ]
398398
399399
@@ -406,7 +406,7 @@ def test_change_namespace_and_prefix():
406406 g = Graph (bind_namespaces = "none" )
407407
408408 g .bind ("foaf" , FOAF1 )
409- assert list (g .namespaces ()) == [(' foaf' , foaf1_uri )]
409+ assert list (g .namespaces ()) == [(" foaf" , foaf1_uri )]
410410
411411 g .bind ("foaf" , FOAF2 , replace = True )
412412 assert list (g .namespaces ()) == [("foaf" , foaf2_uri )]
0 commit comments