Esempio n. 1
0
 def test_serializable(self):
     fj = FileBSON(self.directory, self.name, [])
     content = SerializableClass("1", "2")
     fj.write(content)
     content_r = fj.read()
     self.assertEqual(content_r, {"field1": "1", "field2": "2"})
     self.assertRaises(TypeError, fj.write, NonSerializableClass())
Esempio n. 2
0
 def test_serializable(self):
     fj = FileBSON(self.directory, self.name, [])
     content = SerializableClass("1", "2")
     fj.write(content)
     content_r = fj.read()
     self.assertEqual(content_r, {"field1":"1", "field2":"2"})
     self.assertRaises(TypeError, fj.write, NonSerializableClass())
Esempio n. 3
0
 def test_deserializable_collection(self):
     fj = FileBSON(self.directory, self.name, [])
     content1 = DeserializableClass("1", "2")
     content2 = DeserializableClass("3", "4")
     content = serializable_elist([content1, content2])
     fj.write(content)
     content_r = fj.read()
     self.assertEqual(content, content_r)
Esempio n. 4
0
 def test_deserializable_collection(self):
     fj = FileBSON(self.directory, self.name, [])
     content1 = DeserializableClass("1", "2")
     content2 = DeserializableClass("3", "4")
     content = serializable_elist([content1, content2])
     fj.write(content)
     content_r = fj.read()
     self.assertEqual(content, content_r)
Esempio n. 5
0
 def test_deserializable(self):
     fj = FileBSON(self.directory, self.name, [])
     content = DeserializableClass("1", "2")
     fj.write(content)
     content_r = fj.read()
     self.assertEqual(content, content_r)
Esempio n. 6
0
 def test_write_read(self):
     fj = FileBSON(self.directory, self.name, ["mandatory"])
     content = {"mandatory": "1", "test": "2"}
     fj.write(content)
     content_r = fj.read()
     self.assertEqual(content, content_r)
Esempio n. 7
0
 def test_deserializable(self):
     fj = FileBSON(self.directory, self.name, [])
     content = DeserializableClass("1", "2")
     fj.write(content)
     content_r = fj.read()
     self.assertEqual(content, content_r)
Esempio n. 8
0
 def test_write_read(self):
     fj = FileBSON(self.directory, self.name, ["mandatory"])
     content = {"mandatory":"1", "test":"2"}
     fj.write(content)
     content_r = fj.read()
     self.assertEqual(content, content_r)