From 68c35caa0d1362be60295ab46be777b84321c656 Mon Sep 17 00:00:00 2001 From: Samuel Marks <807580+SamuelMarks@users.noreply.github.com> Date: Mon, 18 Sep 2023 00:51:39 -0400 Subject: [PATCH] [cdd/tests/{mocks/sqlalchemy,test_compound/test_sync_properties}.py] Fix support for Python 3.8 --- cdd/tests/mocks/sqlalchemy.py | 1 + .../test_compound/test_sync_properties.py | 37 +++++++------------ 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/cdd/tests/mocks/sqlalchemy.py b/cdd/tests/mocks/sqlalchemy.py index 6fea1d2f..00a199e5 100644 --- a/cdd/tests/mocks/sqlalchemy.py +++ b/cdd/tests/mocks/sqlalchemy.py @@ -720,6 +720,7 @@ def __repr__(self): ], lineno=None, returns=None, + type_comment=None, decorator_list=[Name(id="staticmethod", ctx=Load())], ) diff --git a/cdd/tests/test_compound/test_sync_properties.py b/cdd/tests/test_compound/test_sync_properties.py index 1f4aa7b8..34d8fa9e 100644 --- a/cdd/tests/test_compound/test_sync_properties.py +++ b/cdd/tests/test_compound/test_sync_properties.py @@ -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( @@ -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( @@ -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" @@ -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" @@ -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), @@ -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" ) @@ -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)" @@ -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,