aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bot/test_constants.py
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2019-10-20 21:14:12 +0200
committerGravatar GitHub <[email protected]>2019-10-20 21:14:12 +0200
commitf194df838c623d3c1b68809230f396a7241508b1 (patch)
treec4376bd37862d868fe100cababc731911d48fabd /tests/bot/test_constants.py
parentMerge pull request #528 from bendiller/antimalware-cog (diff)
parentMerge branch 'master' into unittest-migration (diff)
Merge pull request #517 from python-discord/unittest-migration
Migrating the test suite to the `unittest` framework
Diffstat (limited to 'tests/bot/test_constants.py')
-rw-r--r--tests/bot/test_constants.py26
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)