-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix pylance warnings in tests (#947)
- Loading branch information
1 parent
0e2ec8a
commit 6d50b0a
Showing
51 changed files
with
328 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import asyncio | ||
import random | ||
import typing as t | ||
from io import StringIO | ||
from unittest import TestCase | ||
from unittest.mock import MagicMock, patch | ||
|
@@ -267,7 +268,7 @@ def test_add_table(self, get_app_config: MagicMock): | |
self.assertEqual(self.table_exists("musician"), False) | ||
|
||
@engines_only("postgres", "cockroach") | ||
def test_add_column(self): | ||
def test_add_column(self) -> None: | ||
""" | ||
Test adding a column to a MigrationManager. | ||
""" | ||
|
@@ -304,21 +305,21 @@ def test_add_column(self): | |
response = self.run_sync("SELECT * FROM manager;") | ||
self.assertEqual(response, [{"id": 1, "name": "Dave"}]) | ||
|
||
id = 0 | ||
row_id: t.Optional[int] = None | ||
if engine_is("cockroach"): | ||
id = self.run_sync( | ||
row_id = self.run_sync( | ||
"INSERT INTO manager VALUES (default, 'Dave', '[email protected]') RETURNING id;" # noqa: E501 | ||
) | ||
)[0]["id"] | ||
response = self.run_sync("SELECT * FROM manager;") | ||
self.assertEqual( | ||
response, | ||
[{"id": id[0]["id"], "name": "Dave", "email": "[email protected]"}], | ||
[{"id": row_id, "name": "Dave", "email": "[email protected]"}], | ||
) | ||
|
||
# Reverse | ||
asyncio.run(manager.run(backwards=True)) | ||
response = self.run_sync("SELECT * FROM manager;") | ||
self.assertEqual(response, [{"id": id[0]["id"], "name": "Dave"}]) | ||
self.assertEqual(response, [{"id": row_id, "name": "Dave"}]) | ||
|
||
# Preview | ||
manager.preview = True | ||
|
@@ -333,7 +334,7 @@ def test_add_column(self): | |
if engine_is("postgres"): | ||
self.assertEqual(response, [{"id": 1, "name": "Dave"}]) | ||
if engine_is("cockroach"): | ||
self.assertEqual(response, [{"id": id[0]["id"], "name": "Dave"}]) | ||
self.assertEqual(response, [{"id": row_id, "name": "Dave"}]) | ||
|
||
@engines_only("postgres", "cockroach") | ||
def test_add_column_with_index(self): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.