Skip to content

Commit

Permalink
added test for picklable NodePickler
Browse files Browse the repository at this point in the history
  • Loading branch information
gweis committed Aug 16, 2013
1 parent 39a6cd8 commit 958d5ea
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions test/test_nodepickler.py
@@ -1,4 +1,5 @@
import unittest
import pickle

from rdflib.term import Literal

Expand Down Expand Up @@ -32,14 +33,21 @@ def test_to_bits_from_bits_round_trip(self):
b = np.loads(np.dumps(a))
self.assertEquals(a, b)

def test_literal_cases(self):
def test_literal_cases(self):
np = NodePickler()

for l in cases:
for l in cases:
a = Literal(l)
b = np.loads(np.dumps(a))
self.assertEquals(a, b)


def test_pickle(self):
np = NodePickler()
dump = pickle.dumps(np)
np2 = pickle.loads(dump)
self.assertEquals(np._ids, np2._ids)
self.assertEquals(np._objects, np2._objects)


if __name__ == '__main__':
unittest.main()

0 comments on commit 958d5ea

Please sign in to comment.