summaryrefslogtreecommitdiffstats
path: root/tests/test_docs.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-09-15 16:46:17 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-09-15 16:46:17 +0000
commit28cc22419e32a65fea2d1678400265b8cabc3aff (patch)
treeff9ac1991fd48490b21ef6aa9015a347a165e2d9 /tests/test_docs.py
parentInitial commit. (diff)
downloadsqlglot-28cc22419e32a65fea2d1678400265b8cabc3aff.tar.xz
sqlglot-28cc22419e32a65fea2d1678400265b8cabc3aff.zip
Adding upstream version 6.0.4.upstream/6.0.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_docs.py')
-rw-r--r--tests/test_docs.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_docs.py b/tests/test_docs.py
new file mode 100644
index 0000000..95aa814
--- /dev/null
+++ b/tests/test_docs.py
@@ -0,0 +1,30 @@
+import doctest
+import inspect
+import unittest
+
+import sqlglot
+import sqlglot.optimizer
+import sqlglot.transforms
+
+
+def load_tests(loader, tests, ignore):
+ """
+ This finds and runs all the doctests
+ """
+
+ modules = {
+ mod
+ for module in [sqlglot, sqlglot.transforms, sqlglot.optimizer]
+ for _, mod in inspect.getmembers(module, inspect.ismodule)
+ }
+
+ assert len(modules) >= 20
+
+ for module in modules:
+ tests.addTests(doctest.DocTestSuite(module))
+
+ return tests
+
+
+if __name__ == "__main__":
+ unittest.main()