def test_literal_cases(self): np = NodePickler() for l in cases: a = Literal(l) b = np.loads(np.dumps(a)) self.assertEquals(a, b)
def test_to_bits_from_bits_round_trip(self): np = NodePickler() a = Literal(u'''A test with a \\n (backslash n), "\u00a9" , and newline \n and a second line. ''') b = np.loads(np.dumps(a)) self.assertEquals(a, b)
def test_literal_cases(self): np = NodePickler() for l in cases: a = Literal(l) b = np.loads(np.dumps(a)) self.assertEqual(a, b)
def test_to_bits_from_bits_round_trip(self): np = NodePickler() a = Literal( """A test with a \\n (backslash n), "\u00a9" , and newline \n and a second line. """) b = np.loads(np.dumps(a)) self.assertEqual(a, b)
def pickle_t3st(): print ("test of node pickle") print (__global_test_data__) np = NodePickler() fil = open("testdata.pickle","w") fil.write (np.dumps(__global_test_data__)) fil.close()
def pickle_t3st(): print("test of node pickle") print(__global_test_data__) np = NodePickler() fil = open("testdata.pickle", "w") fil.write(np.dumps(__global_test_data__)) fil.close()
def load_pickle_t3st(): print("test of node pickle loading") print(__global_test_data__) np = NodePickler() fil = open("testdata.pickle") #fil.read (np.loads(__global_test_data__)) o = pickle.load(fil) fil.close()
def node_pickler(self): if getattr(self, "_node_pickler", False) or self._node_pickler is None: self._node_pickler = np = NodePickler() np.register(self, "S") np.register(URIRef, "U") np.register(BNode, "B") np.register(Literal, "L") np.register(Graph, "G") np.register(QuotedGraph, "Q") np.register(Variable, "V") np.register(Statement, "s") return self._node_pickler
def test_pickle(self): np = NodePickler() dump = pickle.dumps(np) np2 = pickle.loads(dump) self.assertEqual(np._ids, np2._ids) self.assertEqual(np._objects, np2._objects)