Exemplo n.º 1
0
    def analyze_classes(self, classes: List[Class]) -> List[Class]:
        """Analyzer the given class list and simplify attributes and
        extensions."""

        container = ClassContainer(config=self.config)
        container.extend(classes)

        return ClassAnalyzer.process(container)
Exemplo n.º 2
0
    def test_process(self, mock_pre_process, mock_process, mock_post_process,
                     mock_select_classes):
        classes = ClassFactory.list(1)
        mock_select_classes.return_value = classes
        analyzer = ClassAnalyzer()

        self.assertEqual(classes, analyzer.process())
        mock_pre_process.assert_called_once_with()
        mock_process.assert_called_once_with()
        mock_post_process.assert_called_once_with()
        mock_select_classes.assert_called_once_with()
Exemplo n.º 3
0
    def test_process(
        self,
        mock_validator_process,
        mock_container_process,
        mock_sanitizer_process,
        mock_select_classes,
    ):
        original_classes = ClassFactory.list(2)
        container = ClassContainer.from_list(original_classes)
        result_classes = ClassFactory.list(1)
        mock_select_classes.return_value = result_classes

        result = ClassAnalyzer.process(original_classes)

        self.assertEqual(result_classes, result)

        mock_validator_process.assert_called_once_with(container)
        mock_container_process.assert_called_once_with()
        mock_sanitizer_process.assert_called_once_with(container)
        mock_select_classes.assert_called_once_with(container)
Exemplo n.º 4
0
    def test_process(
        self,
        mock_validator_process,
        mock_container_process,
        mock_container_filter_classes,
        mock_sanitizer_process,
        mock_validate_references,
    ):
        config = GeneratorConfig()
        classes = ClassFactory.list(2)
        container = ClassContainer(config=config)
        container.extend(classes)

        result = ClassAnalyzer.process(container)

        self.assertEqual(classes, result)

        mock_validator_process.assert_called_once_with()
        mock_container_process.assert_called_once_with()
        mock_container_filter_classes.assert_called_once_with()
        mock_sanitizer_process.assert_called_once_with()
        mock_validate_references.assert_called_once_with(classes)
Exemplo n.º 5
0
 def analyze_classes(self, classes: List[Class]) -> List[Class]:
     """Analyzer the given class list and simplify attributes and
     extensions."""
     return ClassAnalyzer.process(classes, self.config)