def test_find_inner(self): obj = ClassFactory.create(qname="{a}parent") first = ClassFactory.create(qname="{a}a") second = ClassFactory.create(qname="{c}c") third = ClassFactory.enumeration(2, qname="{d}d") obj.inner.extend((first, second, third)) with self.assertRaises(CodeGenerationError) as cm: self.assertIsNone(ClassUtils.find_inner(obj, "nope")) self.assertEqual("Missing inner class {a}parent.nope", str(cm.exception)) self.assertEqual(first, ClassUtils.find_inner(obj, "{a}a")) self.assertEqual(second, ClassUtils.find_inner(obj, "{c}c")) self.assertEqual(third, ClassUtils.find_inner(obj, "{d}d"))
def find_inner(self, source: Class, qname: str) -> Class: inner = ClassUtils.find_inner(source, qname) if inner.status == Status.RAW: self.process_class(inner) return inner