Commits

rgrp  committed 9e29de0

[tests][xs]: rename test_graph() fixture method to our_test_graph to avoid clash with test module test_graph.py.

* Was getting errors like: TypeError: 'module' object is not callable (referring to test_graph).

  • Participants
  • Parent commits 721a9f0

Comments (0)

Files changed (7)

File ordf/tests/__init__.py

 import sys, os
 
 identifier = URIRef("http://example.org/ordf/")
-def test_graph():
+def our_test_graph():
     return fixture("test.rdf", identifier)
 
 def card_graph():

File ordf/tests/test_cs.py

     from rdflib.store.IOMemory import IOMemory
 except ImportError:
     from rdflib.plugins.memory import IOMemory
-from ordf.tests import test_graph, card_graph, identifier, nosep
+from ordf.tests import our_test_graph, card_graph, identifier, nosep
 import os
 
 store = IOMemory()
 
 def test_00_null():
-    orig = test_graph()
-    new = test_graph()
+    orig = our_test_graph()
+    new = our_test_graph()
 
     ## make a changeset from nothing to our test data, and save
     cs = ChangeSet("test_cs", "Testing Fixtures")
 
 def test_01_create():
     orig = Graph(identifier=identifier)
-    new = test_graph()
+    new = our_test_graph()
 
     ## make a changeset from nothing to our test data, and save
     cs = ChangeSet("test_cs", "Testing Fixtures")
 def test_02_remove():
     ## create from empty
     orig = Graph(identifier=identifier)
-    new = test_graph()
+    new = our_test_graph()
     cs = ChangeSet("test_cs", "Creating Graph", store=store)
     assert cs.diff(orig, new) == 85
     cs.commit()
     assert cs
 
     ## delete the data and check
-    removed = test_graph()
+    removed = our_test_graph()
     removed.remove((None, RDF.type, None))
     cs = ChangeSet("test_cs", "Removing Types", store=store)
     assert cs.diff(new, removed) == 18
 
     ## put the data back
     cs = ChangeSet("test_cs", "Adding Types Back", store=store)
-    assert cs.diff(removed, test_graph()) == 18
+    assert cs.diff(removed, our_test_graph()) == 18
     cs.commit()
     assert cs
 
 def test_03_three():
     ## operations on three graphs in one changeset
-    g1 = test_graph()
+    g1 = our_test_graph()
     g2 = card_graph()
     g3 = Graph(identifier="http://example.org/empty")
     g4 = Graph(identifier="http://example.org/empty")

File ordf/tests/test_handler.py

 from ordf.handler import Handler, HandlerPlugin
 from ordf.namespace import RDF, Namespace
 from ordf.graph import Graph
-from ordf.tests import test_graph, identifier
+from ordf.tests import our_test_graph, identifier
 
 ptree_cls = HandlerPlugin.find("pairtree")
 ptree = ptree_cls("data/ordf_test")
 
 def test_03_context():
     ctx = handler.context("test_handler", "create some data")
-    ctx.add(test_graph())
+    ctx.add(our_test_graph())
     ctx.commit()
 
-    g = test_graph()
+    g = our_test_graph()
     g.remove((None, RDF.type, None))
     ctx = handler.context("test_handler", "delete some data")
     ctx.add(g)
     cs.undo(constructed)
 
     ctx = handler.context("test_handler", "put data back")
-    ctx.add(test_graph())
+    ctx.add(our_test_graph())
     ctx.commit()
 
 def test_05_construct():
     ## construct head from changes in previous step
     constructed = handler.construct(identifier)
-    assert len(constructed) == len(test_graph()) + 1
+    assert len(constructed) == len(our_test_graph()) + 1

File ordf/tests/test_obj.py

-from ordf.tests import test_graph
+from ordf.tests import our_test_graph
 from ordf.rdfobj import RDFObj
 from ordf.term import URIRef
 from ordf.namespace import *
 from pprint import pprint
 
 def test_rdfobj():
-    obj = RDFObj(test_graph(), URIRef("urn:uuid:db531d1e-93df-46fe-a79f-f0fe4b99d7c4"))
+    obj = RDFObj(our_test_graph(), URIRef("urn:uuid:db531d1e-93df-46fe-a79f-f0fe4b99d7c4"))
 #    pprint (obj)
 #    pprint (obj[FRBR.creatorOf])

File ordf/tests/test_pt.py

 """
 Test Pairtree storage of models
 """
-from ordf.tests import test_graph, identifier
+from ordf.tests import our_test_graph, identifier
 from ordf.handler import Handler
 from ordf.handler.pt import PairTree
 
 ptree = PairTree("data/ordf_test")
 
 def test_01_create():
-	ptree[identifier] = test_graph()
+	ptree[identifier] = our_test_graph()
 
 def test_02_read():
 	fsobj = ptree[identifier]
     del ptree[identifier]
 
 def test_04_graphops():
-    ptree.put(graph=test_graph())
-    ptree.get(test_graph())
-    ptree.remove(test_graph())
+    ptree.put(graph=our_test_graph())
+    ptree.get(our_test_graph())
+    ptree.remove(our_test_graph())
 
 def test_05_handler():
     handler = Handler()
     handler.register_reader(ptree)
     handler.register_writer(ptree)
     ctx = handler.context("ptree_test", "ptree_test")
-    ctx.add(test_graph())
+    ctx.add(our_test_graph())
     ctx.commit()
 
     for cs in handler.history(identifier):
         ptree.remove(cs)
-    ptree.remove(test_graph())
+    ptree.remove(our_test_graph())

File ordf/tests/test_queue.py

 from ordf.handler.queue import RabbitHandler
 from ordf.handler import Handler, HandlerPlugin
-from ordf.tests import test_graph
+from ordf.tests import our_test_graph
 from time import sleep
 
 class LoggingHandler(HandlerPlugin):
         sleep(1)
     def test_03_send(self):
         ctx = sender.context("test_rabbit", "test_rabbit")
-        ctx.add(test_graph())
+        ctx.add(our_test_graph())
         ctx.commit()
     def test_10_close(self):
         sleep(1)

File ordf/tests/test_rdflib.py

 import tempfile
 import shutil
 
-from ordf.tests import test_graph, identifier
+from ordf.tests import our_test_graph, identifier
 from ordf.handler import Handler
 from ordf.handler.rdf import RDFLib
 
         shutil.rmtree(self.tmpdir)
 
     def test_01_create(self):
-        self.rdf[identifier] = test_graph()
+        self.rdf[identifier] = our_test_graph()
 
     def test_02_read(self):
         g = self.rdf[identifier]
         del self.rdf[identifier]
 
     def test_04_graphops(self):
-        self.rdf.put(graph=test_graph())
-        self.rdf.get(test_graph())
-        self.rdf.remove(test_graph())
+        self.rdf.put(graph=our_test_graph())
+        self.rdf.get(our_test_graph())
+        self.rdf.remove(our_test_graph())
 
     def test_05_handler(self):
         handler = Handler()
         handler.register_reader(self.rdf)
         handler.register_writer(self.rdf)
         ctx = handler.context("rdflib_test", "rdflib_test")
-        ctx.add(test_graph())
+        ctx.add(our_test_graph())
         ctx.commit()
 
         for cs in handler.history(identifier):
             self.rdf.remove(cs)
-        self.rdf.remove(test_graph())
+        self.rdf.remove(our_test_graph())