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())
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())
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)
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)
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)
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)