def test_select_classes_when_no_complex_class_available(self): classes = [ ClassFactory.enumeration(2), ClassFactory.create(type=SimpleType) ] analyzer = ClassAnalyzer.from_classes(classes) self.assertEqual(classes, analyzer.select_classes())
def test_select_classes(self, mock_validate_references): classes = [ ClassFactory.create(strict_type=True, type=ComplexType), ClassFactory.create(type=Element), ClassFactory.create(type=ComplexType), ClassFactory.create(type=SimpleType), ClassFactory.enumeration(2), ] analyzer = ClassAnalyzer.from_classes(classes) expected = [ classes[1], classes[2], classes[4], ] result = analyzer.select_classes() self.assertEqual(expected, result) mock_validate_references.assert_called_once_with(result)
def analyze_classes(classes: List[Class]) -> List[Class]: """Analyzer the given class list and simplify attributes and extensions.""" return ClassAnalyzer.from_classes(classes).process()
def test_from_classes(self): classes = ClassFactory.list(2) analyzer = ClassAnalyzer.from_classes(classes) self.assertEqual(classes, list(analyzer.container.iterate()))