Skip to content

Commit

Permalink
[cdd/tests/{mocks/sqlalchemy,test_compound/test_sync_properties}.py] …
Browse files Browse the repository at this point in the history
…Fix support for Python 3.8
  • Loading branch information
SamuelMarks committed Sep 18, 2023
1 parent 20e5996 commit 68c35ca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
1 change: 1 addition & 0 deletions cdd/tests/mocks/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ def __repr__(self):
],
lineno=None,
returns=None,
type_comment=None,
decorator_list=[Name(id="staticmethod", ctx=Load())],
)

Expand Down
37 changes: 14 additions & 23 deletions cdd/tests/test_compound/test_sync_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,9 @@ def test_sync_properties(self) -> None:
"""Tests `sync_properties` with `call=False`"""

with TemporaryDirectory() as tempdir:
(
input_filename,
input_str,
output_filename,
output_str,
) = populate_files(tempdir)
input_filename, input_str, output_filename, output_str = populate_files(
tempdir
)

self.assertIsNone(
sync_properties(
Expand Down Expand Up @@ -126,12 +123,9 @@ def test_sync_properties_output_param_wrap(self) -> None:
"""Tests `sync_properties` with `output_param_wrap` set"""

with TemporaryDirectory() as tempdir:
(
input_filename,
input_str,
output_filename,
output_str,
) = populate_files(tempdir)
input_filename, input_str, output_filename, output_str = populate_files(
tempdir
)

self.assertIsNone(
sync_properties(
Expand Down Expand Up @@ -159,7 +153,7 @@ def test_sync_properties_output_param_wrap_no_annotation(self) -> None:
"""Tests `sync_properties` with `output_param_wrap` set when type annotation isn't being replaced"""

with TemporaryDirectory() as tempdir:
(input_filename, input_str, output_filename, output_str,) = populate_files(
input_filename, input_str, output_filename, output_str = populate_files(
tempdir,
input_str=(
"from {package} import Literal\n\n"
Expand Down Expand Up @@ -193,7 +187,7 @@ def test_sync_properties_output_param_wrap_no_type(self) -> None:
"""Tests `sync_properties` with `output_param_wrap` set when replacement_node has no type"""

with TemporaryDirectory() as tempdir:
(input_filename, input_str, output_filename, output_str,) = populate_files(
input_filename, input_str, output_filename, output_str = populate_files(
tempdir,
output_str=(
"from {package} import Literal\n\n"
Expand Down Expand Up @@ -231,7 +225,7 @@ def test_sync_properties_output_param_wrap_subscript(self) -> None:
"""Tests `sync_properties` with `output_param_wrap` set when replacement_node is subscript and !input_eval"""

with TemporaryDirectory() as tempdir:
(input_filename, input_str, output_filename, output_str,) = populate_files(
input_filename, input_str, output_filename, output_str = populate_files(
tempdir,
input_str="a = tuple(range(5))",
output_str="def j(k):\n" "{tab}pass\n".format(tab=tab),
Expand Down Expand Up @@ -259,7 +253,7 @@ def test_sync_properties_output_param_wrap_subscript_eval0(self) -> None:
"""Tests `sync_properties` with `output_param_wrap` set when replacement_node is subscript"""

with TemporaryDirectory() as tempdir:
(input_filename, input_str, output_filename, output_str,) = populate_files(
input_filename, input_str, output_filename, output_str = populate_files(
tempdir, input_str="a = tuple(range(5))", output_str="def j(k): pass"
)

Expand Down Expand Up @@ -287,7 +281,7 @@ def test_sync_properties_output_param_wrap_subscript_eval1(self) -> None:
"""Tests `sync_properties` with `output_param_wrap` set when replacement_node is subscript"""

with TemporaryDirectory() as tempdir:
(input_filename, input_str, output_filename, output_str,) = populate_files(
input_filename, input_str, output_filename, output_str = populate_files(
tempdir,
input_str="import pip\n"
"c = { attr: getattr(pip, attr)"
Expand Down Expand Up @@ -325,12 +319,9 @@ def test_sync_properties_output_param_wrap_fails(self) -> None:
"""Tests `sync_properties` fails with `output_param_wrap` set when replacement_node is unknown"""

with TemporaryDirectory() as tempdir:
(
input_filename,
input_str,
output_filename,
output_str,
) = populate_files(tempdir, input_str="local = locals()")
input_filename, input_str, output_filename, output_str = populate_files(
tempdir, input_str="local = locals()"
)

self.assertRaises(
NotImplementedError,
Expand Down

0 comments on commit 68c35ca

Please sign in to comment.