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()
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)
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)
def test_post_process(self, mock_sanitizer, mock_sanitizer_process): analyzer = ClassAnalyzer([]) self.assertIsNone(analyzer.post_process()) mock_sanitizer.assert_called_once_with(analyzer.container) mock_sanitizer_process.assert_called_once_with()
def test_pre_process(self, mock_validator, mock_validator_process): analyzer = ClassAnalyzer([]) self.assertIsNone(analyzer.pre_process()) mock_validator.assert_called_once_with(analyzer.container) mock_validator_process.assert_called_once_with()
def test_from_classes(self): classes = ClassFactory.list(2) analyzer = ClassAnalyzer.from_classes(classes) self.assertEqual(classes, list(analyzer.container.iterate()))