summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCaselIT <cfederico87@gmail.com>2023-03-17 00:50:53 +0100
committerFederico Caselli <cfederico87@gmail.com>2023-05-04 22:53:09 +0200
commit2aba0ada168d0047d54c7a08b0ffdde3102b716b (patch)
tree6334971e00debf16b208de8b12d882a79b75d902 /tests
parente17e59ee2be160fff35b38b08d68766a971b3069 (diff)
downloadalembic-2aba0ada168d0047d54c7a08b0ffdde3102b716b.tar.gz
Add Operations and BatchOperations stub methods
Updated stub generator script to also add stubs method definitions for the :class:`.Operations` class and the :class:`.BatchOperations` class obtained from :meth:`.Operations.batch_alter_table`. Repaired the return signatures for :class:`.Operations` that mostly return ``None``, and were erroneously referring to ``Optional[Table]`` in many cases. Fixes: #1093 Change-Id: I98d38dd5a1e719b4dbbc1003746ec28f26c27808
Diffstat (limited to 'tests')
-rw-r--r--tests/test_stubs.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/test_stubs.py b/tests/test_stubs.py
index d1e286e..5831013 100644
--- a/tests/test_stubs.py
+++ b/tests/test_stubs.py
@@ -4,6 +4,7 @@ import subprocess
import sys
import alembic
+from alembic.testing import combinations
from alembic.testing import eq_
from alembic.testing import TestBase
@@ -16,7 +17,7 @@ def run_command(file):
sys.executable,
str((_home / "tools" / "write_pyi.py").relative_to(_home)),
"--stdout",
- "--file",
+ "--name",
file,
],
stdout=subprocess.PIPE,
@@ -43,6 +44,14 @@ class TestStubFiles(TestBase):
expected = file_path.read_text()
eq_(generated, expected, compare(generated, expected))
+ @combinations("batch_op", "op_cls")
+ def test_operation_base_file(self, name):
+ res = run_command(name)
+ generated = res.stdout
+ file_path = Path(alembic.__file__).parent / "operations/base.py"
+ expected = file_path.read_text()
+ eq_(generated, expected, compare(generated, expected))
+
def compare(actual: str, expected: str):
diff = difflib.unified_diff(