Пример #1
0
    def test_no_importer_for_type(self):
        @codec.register_importer('abc', Part)
        class Abc(codec.Importer):
            pass

        with self.assertRaises(TypeError):
            codec.get_importer(CubeStack, 'abc')
Пример #2
0
    def test_get_registered_subtype(self):
        @codec.register_importer('abc', Component)
        class Abc(codec.Importer):
            pass

        self.assertIsInstance(codec.get_importer(Box, 'abc'), Abc)
Пример #3
0
 def test_no_importer(self):
     with self.assertRaises(TypeError):
         codec.get_importer(Box, 'abc')
Пример #4
0
    def test_get_registered(self):
        @codec.register_importer('abc', Part)
        class Abc(codec.Importer):
            pass

        self.assertIsInstance(codec.get_importer(Box, 'abc'), Abc)