示例#1
0
    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())
示例#2
0
    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)
示例#3
0
 def analyze_classes(classes: List[Class]) -> List[Class]:
     """Analyzer the given class list and simplify attributes and
     extensions."""
     return ClassAnalyzer.from_classes(classes).process()
示例#4
0
 def test_from_classes(self):
     classes = ClassFactory.list(2)
     analyzer = ClassAnalyzer.from_classes(classes)
     self.assertEqual(classes, list(analyzer.container.iterate()))