From c68303802cd58943ca0cea72b869e38fb54dfbe1 Mon Sep 17 00:00:00 2001 From: Sebastian Eibl Date: Wed, 15 Jan 2025 08:27:21 +0100 Subject: [PATCH 1/6] avoid commented-out code (ERA) --- pyproject.toml | 2 ++ tests/unit/nodes/test_function.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 650099bce..84418dd2b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -84,6 +84,8 @@ select = [ "I", # flake8-comprehensions "C4", + # eradicate + "ERA", ] ignore = ["E501"] #ignore line-length violations diff --git a/tests/unit/nodes/test_function.py b/tests/unit/nodes/test_function.py index 3ea0af3c8..62e02cccc 100644 --- a/tests/unit/nodes/test_function.py +++ b/tests/unit/nodes/test_function.py @@ -136,8 +136,8 @@ def test_label_choices(self): self.subTest("Fail on multiple return values"), self.assertRaises(ValueError), ): - # Can't automatically parse output labels from a function with multiple - # return expressions + # Can't automatically parse output labels from a function with + # multiple return expressions function_node(multiple_branches) with self.subTest("Override output label scraping"): From cc5fed0bc73a70bf31c5d7683de7991ed0b2b19b Mon Sep 17 00:00:00 2001 From: liamhuber Date: Wed, 15 Jan 2025 10:18:36 -0800 Subject: [PATCH 2/6] Remove unused test class method Signed-off-by: liamhuber --- tests/unit/nodes/test_composite.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/unit/nodes/test_composite.py b/tests/unit/nodes/test_composite.py index af4ed8ee2..ba0b9299f 100644 --- a/tests/unit/nodes/test_composite.py +++ b/tests/unit/nodes/test_composite.py @@ -22,10 +22,6 @@ class AComposite(Composite): def __init__(self, label): super().__init__(label=label) - def _get_linking_channel(self, child_reference_channel, composite_io_key): - pass # Shouldn't even be abstract honestly - # return child_reference_channel # IO by reference - @property def inputs(self) -> Inputs: # Dynamic IO reflecting current children From a467fea952fbf08c7521766e6f222f62110a3f33 Mon Sep 17 00:00:00 2001 From: liamhuber Date: Wed, 15 Jan 2025 10:22:04 -0800 Subject: [PATCH 3/6] Replace code comment with english comment Signed-off-by: liamhuber --- tests/unit/nodes/test_for_loop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/nodes/test_for_loop.py b/tests/unit/nodes/test_for_loop.py index 00d62d1c2..2efb5e659 100644 --- a/tests/unit/nodes/test_for_loop.py +++ b/tests/unit/nodes/test_for_loop.py @@ -354,7 +354,7 @@ def FiveApart( d=[9, 10, 11], e="e", output_column_map={ - # "a": "out_a", + # Note the absence of the "a" conflicting entry "b": "out_b", "c": "out_c", "d": "out_d", From acd3314860d912d2c3f44a526e0f99b830cef894 Mon Sep 17 00:00:00 2001 From: liamhuber Date: Wed, 15 Jan 2025 10:35:48 -0800 Subject: [PATCH 4/6] Uncomment test And remove outdated comment. Signed-off-by: liamhuber --- tests/unit/nodes/test_macro.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/unit/nodes/test_macro.py b/tests/unit/nodes/test_macro.py index 6b9fc605a..996f637f2 100644 --- a/tests/unit/nodes/test_macro.py +++ b/tests/unit/nodes/test_macro.py @@ -245,11 +245,11 @@ def test_with_executor(self): returned_nodes.one, msg="Executing in a parallel process should be returning new instances", ) - # self.assertIs( - # returned_nodes.one, - # macro.nodes.one, - # msg="Returned nodes should be taken as children" - # ) # You can't do this, result.result() is returning new instances each call + self.assertIs( + returned_nodes.one, + macro.one, + msg="Returned nodes should be taken as children" + ) self.assertIs( macro, macro.one.parent, From 01195e6072ac89c58c46cbdd1d33966e3f258600 Mon Sep 17 00:00:00 2001 From: liamhuber Date: Wed, 15 Jan 2025 10:36:17 -0800 Subject: [PATCH 5/6] Removed commented test portion Signed-off-by: liamhuber --- tests/unit/test_type_hinting.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/unit/test_type_hinting.py b/tests/unit/test_type_hinting.py index 76f84bc68..ad4130b5a 100644 --- a/tests/unit/test_type_hinting.py +++ b/tests/unit/test_type_hinting.py @@ -27,9 +27,6 @@ def __call__(self): (typing.Literal[1, 2], 1, "baz"), (Foo, Foo(), Foo), (type[Bar], Bar, Bar()), - # (callable, Bar(), Foo()), # Misses the bad! - # Can't hint args and returns without typing.Callable anyhow, so that's - # what people should be using regardless (typing.Callable, Bar(), Foo()), (tuple[int, float], (1, 1.1), ("fo", 0)), (dict[str, int], {"a": 1}, {"a": "b"}), From 6bc218f3f837b3e61b3577ef773f888189ceb7a6 Mon Sep 17 00:00:00 2001 From: liamhuber Date: Wed, 15 Jan 2025 10:36:36 -0800 Subject: [PATCH 6/6] Black Signed-off-by: liamhuber --- tests/unit/nodes/test_macro.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/nodes/test_macro.py b/tests/unit/nodes/test_macro.py index 996f637f2..fb402fda2 100644 --- a/tests/unit/nodes/test_macro.py +++ b/tests/unit/nodes/test_macro.py @@ -248,7 +248,7 @@ def test_with_executor(self): self.assertIs( returned_nodes.one, macro.one, - msg="Returned nodes should be taken as children" + msg="Returned nodes should be taken as children", ) self.assertIs( macro,