From 681a8d70fb9c252d6e4dd860a469465d0ee5cf80 Mon Sep 17 00:00:00 2001 From: nfarabullini Date: Tue, 27 Feb 2024 09:45:57 +0100 Subject: [PATCH] removed all # noqa: F811 from tests --- .../frontend_tests/test_defir_to_gtir.py | 2 +- tests/eve_tests/unit_tests/test_codegen.py | 2 +- tests/next_tests/integration_tests/cases.py | 6 ++-- .../ffront_tests/test_execution.py | 36 +++++++++---------- .../feature_tests/test_util_cases.py | 12 +++---- .../ffront_tests/test_embedded_regression.py | 12 +++---- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/tests/cartesian_tests/unit_tests/frontend_tests/test_defir_to_gtir.py b/tests/cartesian_tests/unit_tests/frontend_tests/test_defir_to_gtir.py index 934597f4e5..b952b1bc9e 100644 --- a/tests/cartesian_tests/unit_tests/frontend_tests/test_defir_to_gtir.py +++ b/tests/cartesian_tests/unit_tests/frontend_tests/test_defir_to_gtir.py @@ -46,7 +46,7 @@ def defir_to_gtir(): def test_stencil_definition( defir_to_gtir, - ijk_domain, # noqa: F811 [redefinition, reason: fixture] + ijk_domain, # [redefinition, reason: fixture] ): stencil_definition = ( TDefinition(name="definition", domain=ijk_domain, fields=["a", "b"]) diff --git a/tests/eve_tests/unit_tests/test_codegen.py b/tests/eve_tests/unit_tests/test_codegen.py index 7e7ec2244e..d8d3dce8d6 100644 --- a/tests/eve_tests/unit_tests/test_codegen.py +++ b/tests/eve_tests/unit_tests/test_codegen.py @@ -23,7 +23,7 @@ # -- Name tests -- -def test_name(name_with_cases): # noqa: F811 # pytest fixture not detected +def test_name(name_with_cases): name = codegen.Name(name_with_cases.pop("words")) for case, cased_string in name_with_cases.items(): assert name.as_case(case) == cased_string diff --git a/tests/next_tests/integration_tests/cases.py b/tests/next_tests/integration_tests/cases.py index 8513c98d89..7ebfe2ab11 100644 --- a/tests/next_tests/integration_tests/cases.py +++ b/tests/next_tests/integration_tests/cases.py @@ -474,7 +474,7 @@ def verify_with_default_data( @pytest.fixture def cartesian_case( - exec_alloc_descriptor: test_definitions.ExecutionAndAllocatorDescriptor, # noqa: F811 # fixtures + exec_alloc_descriptor: test_definitions.ExecutionAndAllocatorDescriptor, ): yield Case( exec_alloc_descriptor.executor, @@ -487,8 +487,8 @@ def cartesian_case( @pytest.fixture def unstructured_case( - mesh_descriptor, # noqa: F811 # fixtures - exec_alloc_descriptor: test_definitions.ExecutionAndAllocatorDescriptor, # noqa: F811 # fixtures + mesh_descriptor, + exec_alloc_descriptor: test_definitions.ExecutionAndAllocatorDescriptor, ): yield Case( exec_alloc_descriptor.executor, diff --git a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_execution.py b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_execution.py index 5050008ef1..5db9886966 100644 --- a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_execution.py +++ b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_execution.py @@ -57,7 +57,7 @@ ) -def test_copy(cartesian_case): # noqa: F811 # fixtures +def test_copy(cartesian_case): @gtx.field_operator def testee(a: cases.IJKField) -> cases.IJKField: field_tuple = (a, a) @@ -69,7 +69,7 @@ def testee(a: cases.IJKField) -> cases.IJKField: @pytest.mark.uses_tuple_returns -def test_multicopy(cartesian_case): # noqa: F811 # fixtures +def test_multicopy(cartesian_case): @gtx.field_operator def testee(a: cases.IJKField, b: cases.IJKField) -> tuple[cases.IJKField, cases.IJKField]: return a, b @@ -78,7 +78,7 @@ def testee(a: cases.IJKField, b: cases.IJKField) -> tuple[cases.IJKField, cases. @pytest.mark.uses_cartesian_shift -def test_cartesian_shift(cartesian_case): # noqa: F811 # fixtures +def test_cartesian_shift(cartesian_case): @gtx.field_operator def testee(a: cases.IJKField) -> cases.IJKField: return a(Ioff[1]) @@ -90,7 +90,7 @@ def testee(a: cases.IJKField) -> cases.IJKField: @pytest.mark.uses_unstructured_shift -def test_unstructured_shift(unstructured_case): # noqa: F811 # fixtures +def test_unstructured_shift(unstructured_case): @gtx.field_operator def testee(a: cases.VField) -> cases.EField: return a(E2V[0]) @@ -148,7 +148,7 @@ def composed_shift_unstructured(inp: cases.VField) -> cases.CField: @pytest.mark.uses_cartesian_shift -def test_fold_shifts(cartesian_case): # noqa: F811 # fixtures +def test_fold_shifts(cartesian_case): """Shifting the result of an addition should work.""" @gtx.field_operator @@ -163,7 +163,7 @@ def testee(a: cases.IJKField, b: cases.IJKField) -> cases.IJKField: cases.verify(cartesian_case, testee, a, b, out=out, ref=a.ndarray[1:] + b.ndarray[2:]) -def test_tuples(cartesian_case): # noqa: F811 # fixtures +def test_tuples(cartesian_case): @gtx.field_operator def testee(a: cases.IJKFloatField, b: cases.IJKFloatField) -> cases.IJKFloatField: inps = a, b @@ -175,7 +175,7 @@ def testee(a: cases.IJKFloatField, b: cases.IJKFloatField) -> cases.IJKFloatFiel ) -def test_scalar_arg(unstructured_case): # noqa: F811 # fixtures +def test_scalar_arg(unstructured_case): """Test scalar argument being turned into 0-dim field.""" @gtx.field_operator @@ -194,7 +194,7 @@ def testee(a: int32) -> cases.VField: ) -def test_nested_scalar_arg(unstructured_case): # noqa: F811 # fixtures +def test_nested_scalar_arg(unstructured_case): @gtx.field_operator def testee_inner(a: int32) -> cases.VField: return broadcast(a + 1, (Vertex,)) @@ -212,7 +212,7 @@ def testee(a: int32) -> cases.VField: @pytest.mark.uses_index_fields @pytest.mark.uses_cartesian_shift -def test_scalar_arg_with_field(cartesian_case): # noqa: F811 # fixtures +def test_scalar_arg_with_field(cartesian_case): @gtx.field_operator def testee(a: cases.IJKField, b: int32) -> cases.IJKField: tmp = b * a @@ -226,7 +226,7 @@ def testee(a: cases.IJKField, b: int32) -> cases.IJKField: cases.verify(cartesian_case, testee, a, b, out=out, ref=ref) -def test_scalar_in_domain_spec_and_fo_call(cartesian_case): # noqa: F811 # fixtures +def test_scalar_in_domain_spec_and_fo_call(cartesian_case): pytest.xfail( "Scalar arguments not supported to be used in both domain specification " "and as an argument to a field operator." @@ -253,7 +253,7 @@ def testee(size: gtx.IndexType, out: gtx.Field[[IDim], gtx.IndexType]): @pytest.mark.uses_scan -def test_scalar_scan(cartesian_case): # noqa: F811 # fixtures +def test_scalar_scan(cartesian_case): @gtx.scan_operator(axis=KDim, forward=True, init=(0.0)) def testee_scan(state: float, qc_in: float, scalar: float) -> float: qc = qc_in + state + scalar @@ -273,7 +273,7 @@ def testee(qc: cases.IKFloatField, scalar: float): @pytest.mark.uses_scan @pytest.mark.uses_scan_in_field_operator -def test_tuple_scalar_scan(cartesian_case): # noqa: F811 # fixtures +def test_tuple_scalar_scan(cartesian_case): @gtx.scan_operator(axis=KDim, forward=True, init=0.0) def testee_scan( state: float, qc_in: float, tuple_scalar: tuple[float, tuple[float, float]] @@ -296,7 +296,7 @@ def testee_op( @pytest.mark.uses_cartesian_shift @pytest.mark.uses_scan @pytest.mark.uses_index_fields -def test_scalar_scan_vertical_offset(cartesian_case): # noqa: F811 # fixtures +def test_scalar_scan_vertical_offset(cartesian_case): @gtx.scan_operator(axis=KDim, forward=True, init=(0.0)) def testee_scan(state: float, inp: float) -> float: return inp @@ -336,7 +336,7 @@ def testee_prog(a: cases.IKField): cases.verify(cartesian_case, testee_prog, a, inout=a[1, 3], ref=ref) -def test_astype_int(cartesian_case): # noqa: F811 # fixtures +def test_astype_int(cartesian_case): @gtx.field_operator def testee(a: cases.IFloatField) -> gtx.Field[[IDim], int64]: b = astype(a, int64) @@ -351,7 +351,7 @@ def testee(a: cases.IFloatField) -> gtx.Field[[IDim], int64]: @pytest.mark.uses_tuple_returns -def test_astype_on_tuples(cartesian_case): # noqa: F811 # fixtures +def test_astype_on_tuples(cartesian_case): @gtx.field_operator def field_op_returning_a_tuple( a: cases.IFloatField, b: cases.IFloatField @@ -423,7 +423,7 @@ def cast_nested_tuple( ) -def test_astype_bool_field(cartesian_case): # noqa: F811 # fixtures +def test_astype_bool_field(cartesian_case): @gtx.field_operator def testee(a: cases.IFloatField) -> gtx.Field[[IDim], bool]: b = astype(a, bool) @@ -438,7 +438,7 @@ def testee(a: cases.IFloatField) -> gtx.Field[[IDim], bool]: @pytest.mark.parametrize("inp", [0.0, 2.0]) -def test_astype_bool_scalar(cartesian_case, inp): # noqa: F811 # fixtures +def test_astype_bool_scalar(cartesian_case, inp): @gtx.field_operator def testee(inp: float) -> gtx.Field[[IDim], bool]: return broadcast(astype(inp, bool), (IDim,)) @@ -448,7 +448,7 @@ def testee(inp: float) -> gtx.Field[[IDim], bool]: cases.verify(cartesian_case, testee, inp, out=out, ref=bool(inp)) -def test_astype_float(cartesian_case): # noqa: F811 # fixtures +def test_astype_float(cartesian_case): @gtx.field_operator def testee(a: cases.IFloatField) -> gtx.Field[[IDim], np.float32]: b = astype(a, float32) diff --git a/tests/next_tests/integration_tests/feature_tests/test_util_cases.py b/tests/next_tests/integration_tests/feature_tests/test_util_cases.py index 59c72bbf3f..b12082c44d 100644 --- a/tests/next_tests/integration_tests/feature_tests/test_util_cases.py +++ b/tests/next_tests/integration_tests/feature_tests/test_util_cases.py @@ -38,7 +38,7 @@ def mixed_args( return (a, (c, a)) -def test_allocate_default_unique(cartesian_case): # noqa: F811 # fixtures +def test_allocate_default_unique(cartesian_case): a = cases.allocate(cartesian_case, mixed_args, "a")() assert np.min(a.asnumpy()) == 0 @@ -54,7 +54,7 @@ def test_allocate_default_unique(cartesian_case): # noqa: F811 # fixtures assert np.max(c.asnumpy()) == np.prod(tuple(cartesian_case.default_sizes.values())) * 2 -def test_allocate_return_default_zeros(cartesian_case): # noqa: F811 # fixtures +def test_allocate_return_default_zeros(cartesian_case): a, (b, c) = cases.allocate(cartesian_case, mixed_args, cases.RETURN)() assert np.all(a.asnumpy() == 0) @@ -62,7 +62,7 @@ def test_allocate_return_default_zeros(cartesian_case): # noqa: F811 # fixtures assert np.all(c.asnumpy() == 0) -def test_allocate_const(cartesian_case): # noqa: F811 # fixtures +def test_allocate_const(cartesian_case): a = cases.allocate(cartesian_case, mixed_args, "a").strategy(cases.ConstInitializer(42))() assert np.all(a.asnumpy() == 42) @@ -71,7 +71,7 @@ def test_allocate_const(cartesian_case): # noqa: F811 # fixtures @pytest.mark.parametrize("exec_alloc_descriptor", [definitions.ProgramBackendId.ROUNDTRIP.load()]) -def test_verify_fails_with_wrong_reference(cartesian_case): # noqa: F811 # fixtures +def test_verify_fails_with_wrong_reference(cartesian_case): a = cases.allocate(cartesian_case, addition, "a")() b = cases.allocate(cartesian_case, addition, "b")() out = cases.allocate(cartesian_case, addition, cases.RETURN)() @@ -82,7 +82,7 @@ def test_verify_fails_with_wrong_reference(cartesian_case): # noqa: F811 # fixt @pytest.mark.parametrize("exec_alloc_descriptor", [definitions.ProgramBackendId.ROUNDTRIP.load()]) -def test_verify_fails_with_wrong_type(cartesian_case): # noqa: F811 # fixtures +def test_verify_fails_with_wrong_type(cartesian_case): a = cases.allocate(cartesian_case, addition, "a").dtype(np.float32)() b = cases.allocate(cartesian_case, addition, "b")() out = cases.allocate(cartesian_case, addition, cases.RETURN)() @@ -93,7 +93,7 @@ def test_verify_fails_with_wrong_type(cartesian_case): # noqa: F811 # fixtures @pytest.mark.parametrize("exec_alloc_descriptor", [definitions.ProgramBackendId.ROUNDTRIP.load()]) def test_verify_with_default_data_fails_with_wrong_reference( - cartesian_case, # noqa: F811 # fixtures + cartesian_case, ): def wrong_ref(a, b): return a - b diff --git a/tests/next_tests/integration_tests/multi_feature_tests/ffront_tests/test_embedded_regression.py b/tests/next_tests/integration_tests/multi_feature_tests/ffront_tests/test_embedded_regression.py index 65f017a518..a91779fe75 100644 --- a/tests/next_tests/integration_tests/multi_feature_tests/ffront_tests/test_embedded_regression.py +++ b/tests/next_tests/integration_tests/multi_feature_tests/ffront_tests/test_embedded_regression.py @@ -26,7 +26,7 @@ ) -def test_default_backend_is_respected_field_operator(cartesian_case): # noqa: F811 # fixtures +def test_default_backend_is_respected_field_operator(cartesian_case): """Test that manually calling the field operator without setting the backend raises an error.""" # Important not to set the backend here! @@ -43,7 +43,7 @@ def copy(a: IField) -> IField: _ = copy(a, out=a, offset_provider={}) -def test_default_backend_is_respected_scan_operator(cartesian_case): # noqa: F811 # fixtures +def test_default_backend_is_respected_scan_operator(cartesian_case): """Test that manually calling the scan operator without setting the backend raises an error.""" # Important not to set the backend here! @@ -58,7 +58,7 @@ def sum(state: float, a: float) -> float: _ = sum(a, out=a, offset_provider={}) -def test_default_backend_is_respected_program(cartesian_case): # noqa: F811 # fixtures +def test_default_backend_is_respected_program(cartesian_case): """Test that manually calling the program without setting the backend raises an error.""" @gtx.field_operator @@ -78,7 +78,7 @@ def copy_program(a: IField, b: IField) -> IField: _ = copy_program(a, b, offset_provider={}) -def test_missing_arg_field_operator(cartesian_case): # noqa: F811 # fixtures +def test_missing_arg_field_operator(cartesian_case): """Test that calling a field_operator without required args raises an error.""" @gtx.field_operator(backend=cartesian_case.executor) @@ -94,7 +94,7 @@ def copy(a: IField) -> IField: _ = copy(a, out=a) -def test_missing_arg_scan_operator(cartesian_case): # noqa: F811 # fixtures +def test_missing_arg_scan_operator(cartesian_case): """Test that calling a scan_operator without required args raises an error.""" @gtx.scan_operator(backend=cartesian_case.executor, axis=KDim, init=0.0, forward=True) @@ -110,7 +110,7 @@ def sum(state: float, a: float) -> float: _ = sum(a, out=a) -def test_missing_arg_program(cartesian_case): # noqa: F811 # fixtures +def test_missing_arg_program(cartesian_case): """Test that calling a program without required args raises an error.""" @gtx.field_operator