diff options
| author | 2019-10-25 08:51:25 -0400 | |
|---|---|---|
| committer | 2019-10-25 08:51:25 -0400 | |
| commit | 2b1c18e52c9072f3e8f04984a7a8900537a1e193 (patch) | |
| tree | 6e9e45e62b6423fc1c440eafded277dd32f53abf /tests/bot/test_constants.py | |
| parent | Fix incorrect type hint for return value (diff) | |
| parent | Prepend emoji indicative of success of !eval (#552) (diff) | |
Merge branch 'master' into show-trigger-word
Diffstat (limited to '')
| -rw-r--r-- | tests/bot/test_constants.py | 26 | 
1 files changed, 26 insertions, 0 deletions
| diff --git a/tests/bot/test_constants.py b/tests/bot/test_constants.py new file mode 100644 index 000000000..dae7c066c --- /dev/null +++ b/tests/bot/test_constants.py @@ -0,0 +1,26 @@ +import inspect +import unittest + +from bot import constants + + +class ConstantsTests(unittest.TestCase): +    """Tests for our constants.""" + +    def test_section_configuration_matches_type_specification(self): +        """The section annotations should match the actual types of the sections.""" + +        sections = ( +            cls +            for (name, cls) in inspect.getmembers(constants) +            if hasattr(cls, 'section') and isinstance(cls, type) +        ) +        for section in sections: +            for name, annotation in section.__annotations__.items(): +                with self.subTest(section=section, name=name, annotation=annotation): +                    value = getattr(section, name) + +                    if getattr(annotation, '_name', None) in ('Dict', 'List'): +                        self.skipTest("Cannot validate containers yet.") + +                    self.assertIsInstance(value, annotation) | 
