Esempio n. 1
0
 def test_mem_registry(self):
     r = base.FilesystemRegistry(self.memfs, ytk.YTKPart)
     self.assertIn("pYTK002", r)
     self.assertNotIn("pYTK003", r)
     self.assertIsInstance(r["pYTK002"].entity, ytk.YTKPart1)
     self.assertIsInstance(r["pYTK038"].entity, ytk.YTKPart3a)
     self.assertEqual(r["pYTK002"].resistance, "Chloramphenicol")
Esempio n. 2
0
 def test_circular_record(self):
     r = base.FilesystemRegistry(self.memfs, ytk.YTKPart)
     self.assertIsInstance(r["pYTK002"].entity.record, CircularRecord)
Esempio n. 3
0
 def test_len(self):
     r = base.FilesystemRegistry(self.memfs, ytk.YTKPart)
     self.assertEqual(len(r), len(list(r)))
     self.assertEqual(len(r), len(self.memfs.listdir("/")))
Esempio n. 4
0
 def test_iter(self):
     r = base.FilesystemRegistry(self.memfs, ytk.YTKPart)
     self.assertTrue(all(x in r for x in r))
     self.assertEqual(sorted(r), ["pYTK002", "pYTK038"])
Esempio n. 5
0
 def test_invalid_base(self):
     r = base.FilesystemRegistry(self.memfs, ytk.YTKPart8)
     self.assertRaises(RuntimeError, r.__getitem__, "pYTK002")