Esempio n. 1
0
 def test_adding_backend(self):
     FileStorage.register_backend("example", ExampleFile)
     self.assertEqual(FileStorage.BACKENDS["example"], ExampleFile)
     fs = FileStorage("example", "filename")
     recs = fs.load()
     self.assertEqual(len(recs), 1)
     self.assertEqual(recs[0].fields, ["a", "b"])
Esempio n. 2
0
 def test_removing_backend(self):
     FileStorage.register_backend("example", ExampleFile)
     self.assertEqual(FileStorage.BACKENDS["example"], ExampleFile)
     FileStorage.unregister_backend("example")
     with self.assertRaises(KeyError):
         FileStorage.BACKENDS["example"]