@@ -338,37 +338,51 @@ def test_type_add(self):
338
338
trip = (URIRef ('http://example.org#type-add' ), RDF .type , URIRef ('http://example.org/cra' ))
339
339
self .graph .add (trip )
340
340
self .graph .add (trip )
341
+ # No exception raised
341
342
342
343
def test_type_addn (self ):
343
344
quad = (URIRef ('http://example.org#type-addn' ), RDF .type , URIRef ('http://example.org/cra' ), self .graph )
344
345
self .graph .addN ([quad , quad ])
346
+ # No exception raised
345
347
346
348
def test_add (self ):
347
349
trip = (URIRef ('http://example.org#add' ), URIRef ('http://example.org/blah' ), URIRef ('http://example.org/cra' ))
348
350
self .graph .add (trip )
349
351
self .graph .add (trip )
352
+ # No exception raised
350
353
351
354
def test_addn (self ):
352
355
quad = (URIRef ('http://example.org#addn' ),
353
356
URIRef ('http://example.org/blah' ),
354
357
URIRef ('http://example.org/cra' ),
355
358
self .graph )
356
359
self .graph .addN ([quad , quad ])
360
+ # No exception raised
357
361
358
362
def test_namespace_change_prefix_binding (self ):
359
363
nm = self .graph .namespace_manager
360
364
nm .bind ('change_binding' , URIRef ('http://example.org/change-binding-1#' ),
361
365
replace = True )
362
366
nm .bind ('change_binding' , URIRef ('http://example.org/change-binding-2#' ),
363
367
replace = True )
364
- assert ('change_binding' ,
365
- URIRef ('http://example.org/change-binding-2#' )) in list (nm .namespaces ())
368
+ self .assertIn (
369
+ ('change_binding' , URIRef ('http://example.org/change-binding-2#' )),
370
+ list (nm .namespaces ())
371
+ )
366
372
367
373
def test_namespace_rebind_prefix (self ):
368
374
nm = self .graph .namespace_manager
369
375
nm .bind ('rebind' , URIRef ('http://example.org/rebind#' ))
370
376
nm .bind ('rebind' , URIRef ('http://example.org/rebind#' ))
371
377
378
+ def test_add_duplicate_length (self ):
379
+ '''
380
+ Test that adding duplicate triples doesn't increase the length of the graph
381
+ '''
382
+ trip = (URIRef ('http://example.org#add' ), URIRef ('http://example.org/blah' ), URIRef ('http://example.org/cra' ))
383
+ self .graph .add (trip )
384
+ self .graph .add (trip )
385
+ self .assertEqual (len (self .graph ), 1 )
372
386
# additional tests
373
387
# - add "duplicate" triples and query -- ensure the graph length counts only distinct
374
388
# triples
0 commit comments