Ejemplo n.º 1
0
 def test_0_default(self):
     self.assertTrue(len(resolve_writer(".png")) > 0, "has png writer")
     self.assertTrue(len(resolve_writer(".nrrd")) > 0, "has nrrd writer")
     self.assertTrue(len(resolve_writer("unknown")) > 0, "has writer")
     register_writer("unknown1", lambda:
                     (_ for _ in ()).throw(OptionalImportError))
     with self.assertRaises(OptionalImportError):
         resolve_writer("unknown1")
Ejemplo n.º 2
0
 def test_1_new(self):
     register_writer("new", lambda x: x + 1)
     register_writer("new2", lambda x: x + 1)
     self.assertEqual(resolve_writer("new")[0](0), 1)