This is an automated email from the ASF dual-hosted git repository. skrawcz pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/hamilton.git
commit 846cc74b207c4e4df4eeefa77cbf8427d1fa6e37 Author: Dev-iL <[email protected]> AuthorDate: Sat Feb 14 17:15:07 2026 +0200 Standardize `@pytest.mark.parametrize` parameters (PT006, PT007) --- plugin_tests/h_dask/test_h_dask.py | 4 ++-- plugin_tests/h_spark/test_h_schema.py | 2 +- plugin_tests/h_spark/test_h_spark.py | 14 ++++++------- pyproject.toml | 2 ++ tests/caching/result_store/test_file.py | 2 +- tests/caching/test_fingerprinting.py | 4 ++-- tests/caching/test_integration.py | 2 +- tests/caching/test_result_store.py | 2 +- tests/execution/test_executors.py | 2 +- tests/execution/test_graph_functions.py | 4 ++-- tests/function_modifiers/test_adapters.py | 2 +- tests/function_modifiers/test_base.py | 8 ++++---- tests/function_modifiers/test_delayed.py | 2 +- tests/function_modifiers/test_dependencies.py | 8 ++++---- tests/function_modifiers/test_expanders.py | 12 +++++------ tests/function_modifiers/test_macros.py | 6 +++--- tests/function_modifiers/test_recursive.py | 6 +++--- tests/lifecycle/test_lifecycle_base.py | 4 ++-- tests/plugins/test_logging.py | 2 +- tests/plugins/test_yaml_extension.py | 10 +++++----- tests/test_base.py | 10 +++++----- tests/test_common.py | 2 +- tests/test_default_data_quality.py | 6 +++--- tests/test_dev_utils.py | 5 +++-- tests/test_end_to_end.py | 2 +- tests/test_graph.py | 8 ++++---- tests/test_hamilton_driver.py | 2 +- tests/test_node.py | 2 +- tests/test_parallel_graceful.py | 2 +- tests/test_telemetry.py | 4 ++-- tests/test_type_utils.py | 10 +++++----- .../tests/test_db_methods/test_permissions.py | 23 ++++++++++------------ 32 files changed, 87 insertions(+), 87 deletions(-) diff --git a/plugin_tests/h_dask/test_h_dask.py b/plugin_tests/h_dask/test_h_dask.py index abea8596..d87acc92 100644 --- a/plugin_tests/h_dask/test_h_dask.py +++ b/plugin_tests/h_dask/test_h_dask.py @@ -206,7 +206,7 @@ dd_test_case_ids = [ ] [email protected]("outputs, expected", dd_test_cases, ids=dd_test_case_ids) [email protected](("outputs", "expected"), dd_test_cases, ids=dd_test_case_ids) def test_DDFR_build_result_pandas(client, outputs: dict[str, typing.Any], expected: dd.DataFrame): """Tests using pandas objects works""" actual = h_dask.DaskDataFrameResult.build_result(**outputs) @@ -215,7 +215,7 @@ def test_DDFR_build_result_pandas(client, outputs: dict[str, typing.Any], expect pd.testing.assert_frame_equal(actual_pdf, expected_pdf) [email protected]("outputs, expected", dd_test_cases, ids=dd_test_case_ids) [email protected](("outputs", "expected"), dd_test_cases, ids=dd_test_case_ids) def test_DDFR_build_result_dask(client, outputs: dict[str, typing.Any], expected: dd.DataFrame): """Tests that using dask objects works.""" dask_outputs = {} diff --git a/plugin_tests/h_spark/test_h_schema.py b/plugin_tests/h_spark/test_h_schema.py index 7a85486f..f41ac437 100644 --- a/plugin_tests/h_spark/test_h_schema.py +++ b/plugin_tests/h_spark/test_h_schema.py @@ -36,7 +36,7 @@ def spark_session(): @pytest.mark.parametrize( - "spark_type,arrow_type", + ("spark_type", "arrow_type"), [ (pt.NullType(), pa.null()), (pt.BooleanType(), pa.bool_()), diff --git a/plugin_tests/h_spark/test_h_spark.py b/plugin_tests/h_spark/test_h_spark.py index 8a36d5ab..809e3f74 100644 --- a/plugin_tests/h_spark/test_h_spark.py +++ b/plugin_tests/h_spark/test_h_spark.py @@ -319,7 +319,7 @@ def test_smoke_screen_udf_graph_adapter(spark_session): # Test cases for python_to_spark_type function @pytest.mark.parametrize( - "python_type,expected_spark_type", + ("python_type", "expected_spark_type"), [ (int, types.IntegerType()), (float, types.FloatType()), @@ -341,7 +341,7 @@ def test_python_to_spark_type_invalid(invalid_python_type): # Test cases for get_spark_type function # 1. Basic Python types @pytest.mark.parametrize( - "return_type,expected_spark_type", + ("return_type", "expected_spark_type"), [ (int, types.IntegerType()), (float, types.FloatType()), @@ -356,7 +356,7 @@ def test_get_spark_type_basic_types(return_type, expected_spark_type): # 2. Lists of basic Python types @pytest.mark.parametrize( - "return_type,expected_spark_type", + ("return_type", "expected_spark_type"), [ (int, types.ArrayType(types.IntegerType())), (float, types.ArrayType(types.FloatType())), @@ -372,7 +372,7 @@ def test_get_spark_type_list_types(return_type, expected_spark_type): # 3. Numpy types (assuming you have a numpy_to_spark_type function that handles these) @pytest.mark.parametrize( - "return_type,expected_spark_type", + ("return_type", "expected_spark_type"), [ (np.int64, types.IntegerType()), (np.float64, types.FloatType()), @@ -548,7 +548,7 @@ def _two_pyspark_dataframe_parameters(foo: DataFrame, bar: int, baz: DataFrame) @pytest.mark.parametrize( - "fn,requested_parameter,expected", + ("fn", "requested_parameter", "expected"), [ (_only_pyspark_dataframe_parameter, "foo", "foo"), (_one_pyspark_dataframe_parameter, "foo", "foo"), @@ -564,7 +564,7 @@ def test_derive_dataframe_parameter_succeeds(fn, requested_parameter, expected): @pytest.mark.parametrize( - "fn,requested_parameter", + ("fn", "requested_parameter"), [ (_no_pyspark_dataframe_parameter, "foo"), (_no_pyspark_dataframe_parameter, None), @@ -871,7 +871,7 @@ def not_pyspark_fn(foo: DataFrame, bar: DataFrame) -> DataFrame: @pytest.mark.parametrize( - "fn,expected", [(pyspark_fn_1, True), (pyspark_fn_2, True), (not_pyspark_fn, False)] + ("fn", "expected"), [(pyspark_fn_1, True), (pyspark_fn_2, True), (not_pyspark_fn, False)] ) def test_is_default_pyspark_node(fn, expected): node_ = node.Node.from_fn(fn) diff --git a/pyproject.toml b/pyproject.toml index bb6b03ff..39e757bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -223,6 +223,8 @@ extend-select = [ # "PERF",# Linting rules for performance # "PIE", # flake8-pie rules # "PT", # flake8-pytest-style rules + "PT006", + "PT007", # "PYI", # Linting rules for type annotations. "Q", # Linting rules for quites # "RUF", # Unused noqa directive diff --git a/tests/caching/result_store/test_file.py b/tests/caching/result_store/test_file.py index 5078765a..e4ed46bb 100644 --- a/tests/caching/result_store/test_file.py +++ b/tests/caching/result_store/test_file.py @@ -109,7 +109,7 @@ def test_delete_all(file_store): @pytest.mark.parametrize( - "format,value", + ("format", "value"), [ ("json", {"key1": "value1", "key2": 2}), ("pickle", ("value1", "value2", "value3")), diff --git a/tests/caching/test_fingerprinting.py b/tests/caching/test_fingerprinting.py index 889eebb6..0b28bc57 100644 --- a/tests/caching/test_fingerprinting.py +++ b/tests/caching/test_fingerprinting.py @@ -127,7 +127,7 @@ def test_max_recursion_depth(): @pytest.mark.parametrize( - "obj,expected_hash", + ("obj", "expected_hash"), [ ("hello-world", "IJUxIYl1PeatR9_iDL6X7A=="), (17.31231, "vAYX8MD8yEHK6dwnIPVUaw=="), @@ -142,7 +142,7 @@ def test_hash_primitive(obj, expected_hash): @pytest.mark.parametrize( - "obj,expected_hash", + ("obj", "expected_hash"), [ ([0, True, "hello-world"], "Pg9LP3Y-8yYsoWLXedPVKDwTAa7W8_fjJNTTUA=="), ((17.0, False, "world"), "wyuuKMuL8rp53_CdYAtyMmyetnTJ9LzmexhJrQ=="), diff --git a/tests/caching/test_integration.py b/tests/caching/test_integration.py index 16f1810e..05a6cf64 100644 --- a/tests/caching/test_integration.py +++ b/tests/caching/test_integration.py @@ -545,7 +545,7 @@ EXECUTORS_AND_STORES_CONFIGURATIONS += IN_MEMORY_CONFIGURATIONS @pytest.mark.parametrize( - "executor,metadata_store,result_store", EXECUTORS_AND_STORES_CONFIGURATIONS, indirect=True + ("executor", "metadata_store", "result_store"), EXECUTORS_AND_STORES_CONFIGURATIONS, indirect=True ) def test_parallel_synchronous_step_by_step(executor, metadata_store, result_store): # noqa: F811 dr = ( diff --git a/tests/caching/test_result_store.py b/tests/caching/test_result_store.py index b0256879..e8d6bcee 100644 --- a/tests/caching/test_result_store.py +++ b/tests/caching/test_result_store.py @@ -116,7 +116,7 @@ def test_delete_all(result_store): @pytest.mark.parametrize( - "format,value", + ("format", "value"), [ ("json", {"key1": "value1", "key2": 2}), ("pickle", ("value1", "value2", "value3")), diff --git a/tests/execution/test_executors.py b/tests/execution/test_executors.py index 033d142d..a3c20ee8 100644 --- a/tests/execution/test_executors.py +++ b/tests/execution/test_executors.py @@ -237,7 +237,7 @@ def create_dummy_task(task_purpose: NodeGroupPurpose): @pytest.mark.parametrize( - "purpose, check", + ("purpose", "check"), [ (NodeGroupPurpose.EXECUTE_BLOCK, lambda x: isinstance(x, MultiProcessingExecutor)), (NodeGroupPurpose.EXECUTE_SINGLE, lambda x: isinstance(x, SynchronousLocalTaskExecutor)), diff --git a/tests/execution/test_graph_functions.py b/tests/execution/test_graph_functions.py index 6a31832d..e5a9e52f 100644 --- a/tests/execution/test_graph_functions.py +++ b/tests/execution/test_graph_functions.py @@ -60,7 +60,7 @@ def _assert_topologically_sorted(nodes, sorted_nodes): @pytest.mark.parametrize( - "dag_input, expected_sorted_nodes", + ("dag_input", "expected_sorted_nodes"), [ ({"a": [], "b": ["a"], "c": ["a"], "d": ["b", "c"], "e": ["d"]}, ["a", "b", "c", "d", "e"]), ({}, []), @@ -109,7 +109,7 @@ def _is(name: str) -> Callable[[node.Node], bool]: @pytest.mark.parametrize( - "dag_repr, expected_nodes_in_between, start_node, end_node", + ("dag_repr", "expected_nodes_in_between", "start_node", "end_node"), [ ( {"a": [], "b": ["a"], "c": ["b"]}, diff --git a/tests/function_modifiers/test_adapters.py b/tests/function_modifiers/test_adapters.py index 809837bb..18b09e3a 100644 --- a/tests/function_modifiers/test_adapters.py +++ b/tests/function_modifiers/test_adapters.py @@ -330,7 +330,7 @@ def test_validate_selects_correct_type(): # Note that this tests an internal API, but we would like to test this to ensure # class selection is correct @pytest.mark.parametrize( - "type_,classes,correct_class", + ("type_", "classes", "correct_class"), [ (str, [StringDataLoader, IntDataLoader, IntDataLoader2], StringDataLoader), (int, [StringDataLoader, IntDataLoader, IntDataLoader2], IntDataLoader2), diff --git a/tests/function_modifiers/test_base.py b/tests/function_modifiers/test_base.py index 896f078c..74d0d240 100644 --- a/tests/function_modifiers/test_base.py +++ b/tests/function_modifiers/test_base.py @@ -32,7 +32,7 @@ power_mode_k = settings.ENABLE_POWER_USER_MODE @pytest.mark.parametrize( - "config,config_required,config_optional_with_defaults,expected", + ("config", "config_required", "config_optional_with_defaults", "expected"), [ ({"foo": 1}, ["foo"], None, {"foo": 1, power_mode_k: False}), ({"foo": 1}, ["foo"], {}, {"foo": 1, power_mode_k: False}), @@ -69,7 +69,7 @@ def test_merge_config_happy(config, config_required, config_optional_with_defaul @pytest.mark.parametrize( - "config,config_required,config_optional_with_defaults", + ("config", "config_required", "config_optional_with_defaults"), [ ({"foo": 1}, ["bar"], {}), ({"bar": 2}, ["foo"], {"baz": 3}), @@ -97,7 +97,7 @@ def _create_node_set(names_to_deps: dict[str, list[str]]) -> list[Node]: @pytest.mark.parametrize( - "target,nodes,expected", + ("target", "nodes", "expected"), [ # Testing None -- E.G. final nodes (None, {}, []), @@ -145,7 +145,7 @@ def test_select_nodes_happy( @pytest.mark.parametrize( - "target,nodes", + ("target", "nodes"), [ ("d", _create_node_set({"a": []})), (["d", "a"], _create_node_set({"a": []})), diff --git a/tests/function_modifiers/test_delayed.py b/tests/function_modifiers/test_delayed.py index e209ad6f..4dcf1181 100644 --- a/tests/function_modifiers/test_delayed.py +++ b/tests/function_modifiers/test_delayed.py @@ -38,7 +38,7 @@ CONFIG_WITH_POWER_MODE_DISABLED = { @pytest.mark.parametrize( - "fn,required,optional", + ("fn", "required", "optional"), [ (lambda: 1, [], {}), (lambda a, b: 1, ["a", "b"], {}), diff --git a/tests/function_modifiers/test_dependencies.py b/tests/function_modifiers/test_dependencies.py index c06c19c1..04ca5c6d 100644 --- a/tests/function_modifiers/test_dependencies.py +++ b/tests/function_modifiers/test_dependencies.py @@ -26,7 +26,7 @@ from hamilton.function_modifiers.dependencies import ( @pytest.mark.parametrize( - "upstream_source,expected", + ("upstream_source", "expected"), [("foo", UpstreamDependency("foo")), (UpstreamDependency("bar"), UpstreamDependency("bar"))], ) def test_upstream(upstream_source, expected): @@ -34,7 +34,7 @@ def test_upstream(upstream_source, expected): @pytest.mark.parametrize( - "literal_value,expected", + ("literal_value", "expected"), [ ("foo", LiteralDependency("foo")), (LiteralDependency("foo"), LiteralDependency("foo")), @@ -46,7 +46,7 @@ def test_literal(literal_value, expected): @pytest.mark.parametrize( - "args,kwargs", + ("args", "kwargs"), [ ([source("foo"), source("bar")], {}), ([source("foo"), value("bar")], {}), @@ -62,7 +62,7 @@ def test_validate_group_happy(args, kwargs): @pytest.mark.parametrize( - "args,kwargs", + ("args", "kwargs"), [ ([source("foo"), source("bar")], {"foo": source("foo")}), ([source("foo"), value("bar")], {"foo": source("foo")}), diff --git a/tests/function_modifiers/test_expanders.py b/tests/function_modifiers/test_expanders.py index 55ae3718..fa11b5c0 100644 --- a/tests/function_modifiers/test_expanders.py +++ b/tests/function_modifiers/test_expanders.py @@ -365,7 +365,7 @@ class MyDictInheritanceBadCase(TypedDict): @pytest.mark.parametrize( - "return_type_str,fields", + ("return_type_str", "fields"), [ ("MyDict", ()), ("MyDict", {"test2": str}), @@ -389,7 +389,7 @@ def test_extract_fields_valid_annotations_for_inferred_types(return_type_str, fi @pytest.mark.parametrize( - "return_type_str,fields", + ("return_type_str", "fields"), [ ("int", {"A": int}), ("list", {"A": int}), @@ -765,7 +765,7 @@ def test_unpack_fields_transform_on_indeterminate_tuple(): @pytest.mark.parametrize( - "return_type_str,fields", + ("return_type_str", "fields"), [ ("tuple[int, int]", ("A", "B")), ("tuple[int, int, str]", ("A", "B", "C")), @@ -783,7 +783,7 @@ def test_unpack_fields_valid_type_annotations(return_type_str, fields): @pytest.mark.parametrize( - "return_type_str,fields", + ("return_type_str", "fields"), [ ("int", ("A",)), ("list", ("A",)), @@ -1037,7 +1037,7 @@ def test_inject_multiple_things(): @pytest.mark.parametrize( - "annotated_type,cls,expected", + ("annotated_type", "cls", "expected"), [ (list[int], GroupedListDependency, int), (list[list[int]], GroupedListDependency, list[int]), @@ -1056,7 +1056,7 @@ def test_resolve_dependency_type_happy( @pytest.mark.parametrize( - "annotated_type,cls", + ("annotated_type", "cls"), [ (int, GroupedDictDependency), (int, GroupedListDependency), diff --git a/tests/function_modifiers/test_macros.py b/tests/function_modifiers/test_macros.py index 7014903a..f8da2a23 100644 --- a/tests/function_modifiers/test_macros.py +++ b/tests/function_modifiers/test_macros.py @@ -107,7 +107,7 @@ def _a_b_c(a: int, b: int, c: int) -> int: @pytest.mark.parametrize( - "fn,replace_with,argument_mapping,matches", + ("fn", "replace_with", "argument_mapping", "matches"), [ (_no_params, _empty, {}, True), (_no_params, _kwargs, {}, True), @@ -259,7 +259,7 @@ def _test_apply_function(foo: int, bar: int, baz: int = 100) -> int: @pytest.mark.parametrize( - "args,kwargs,chain_first_param", + ("args", "kwargs", "chain_first_param"), [ ([source("foo_upstream"), value(1)], {}, False), ([value(1)], {}, True), @@ -279,7 +279,7 @@ def test_applicable_validates_correctly(args, kwargs, chain_first_param: bool): @pytest.mark.parametrize( - "args,kwargs,chain_first_param", + ("args", "kwargs", "chain_first_param"), [ ( [source("foo_upstream"), value(1)], diff --git a/tests/function_modifiers/test_recursive.py b/tests/function_modifiers/test_recursive.py index 4452fb59..282b3760 100644 --- a/tests/function_modifiers/test_recursive.py +++ b/tests/function_modifiers/test_recursive.py @@ -491,7 +491,7 @@ def test_nested_subdag_with_config_remapping_missing_error(): @pytest.mark.parametrize( - "configuration,fields,expected", + ("configuration", "fields", "expected"), [ ({"a": 1, "b": 2}, {}, {"a": 1, "b": 2}), ({"a": 1, "b": 2}, {"c": value(3)}, {"a": 1, "b": 2, "c": 3}), @@ -653,7 +653,7 @@ def test_nested_parameterized_subdag_with_config(): @pytest.mark.parametrize( - "config, inputs", + ("config", "inputs"), [ ({"foo": "bar"}, {}), ({"foo": "bar"}, {"input": source("foo")}), @@ -665,7 +665,7 @@ def test_recursive_validate_config_inputs_happy(config, inputs): @pytest.mark.parametrize( - "config, inputs", + ("config", "inputs"), [ ({"foo": "bar"}, {"foo": source("baz")}), ({"foo": "bar"}, {"input": "baz"}), diff --git a/tests/lifecycle/test_lifecycle_base.py b/tests/lifecycle/test_lifecycle_base.py index 43380127..6b5999d7 100644 --- a/tests/lifecycle/test_lifecycle_base.py +++ b/tests/lifecycle/test_lifecycle_base.py @@ -66,7 +66,7 @@ def _valid_function_self_kwargs(self, *, a: int, b: int) -> int: @pytest.mark.parametrize( - "fn,returns_value,specified_return_value", + ("fn", "returns_value", "specified_return_value"), [ (_valid_function_empty, False, None), (_valid_function_returns_value, True, None), @@ -104,7 +104,7 @@ def _function_with_return_annotation() -> int: @pytest.mark.parametrize( - "fn, returns_value", + ("fn", "returns_value"), [ (_valid_function_empty, True), (_valid_function_returns_value, False), diff --git a/tests/plugins/test_logging.py b/tests/plugins/test_logging.py index 1c1077df..5434612a 100644 --- a/tests/plugins/test_logging.py +++ b/tests/plugins/test_logging.py @@ -254,7 +254,7 @@ def test_logging_async_nodes(caplog): @pytest.mark.parametrize( - ["executor_type", "executor_args", "check_context"], + ("executor_type", "executor_args", "check_context"), [ (executors.SynchronousLocalTaskExecutor, {}, True), (executors.MultiProcessingExecutor, {"max_tasks": 1}, False), diff --git a/tests/plugins/test_yaml_extension.py b/tests/plugins/test_yaml_extension.py index ff7514bf..8d064213 100644 --- a/tests/plugins/test_yaml_extension.py +++ b/tests/plugins/test_yaml_extension.py @@ -34,7 +34,7 @@ TEST_DATA_FOR_YAML = [ ] [email protected]("data, file_name", TEST_DATA_FOR_YAML) [email protected](("data", "file_name"), TEST_DATA_FOR_YAML) def test_yaml_loader(tmp_path: pathlib.Path, data, file_name): path = tmp_path / pathlib.Path(file_name) with path.open(mode="w") as f: @@ -45,7 +45,7 @@ def test_yaml_loader(tmp_path: pathlib.Path, data, file_name): assert loaded_data[0] == data [email protected]("data, file_name", TEST_DATA_FOR_YAML) [email protected](("data", "file_name"), TEST_DATA_FOR_YAML) def test_yaml_saver(tmp_path: pathlib.Path, data, file_name): path = tmp_path / pathlib.Path(file_name) saver = YAMLDataSaver(path) @@ -56,7 +56,7 @@ def test_yaml_saver(tmp_path: pathlib.Path, data, file_name): assert data == loaded_data [email protected]("data, file_name", TEST_DATA_FOR_YAML) [email protected](("data", "file_name"), TEST_DATA_FOR_YAML) def test_yaml_loader_and_saver(tmp_path: pathlib.Path, data, file_name): path = tmp_path / pathlib.Path(file_name) saver = YAMLDataSaver(path) @@ -68,7 +68,7 @@ def test_yaml_loader_and_saver(tmp_path: pathlib.Path, data, file_name): @pytest.mark.parametrize( - "type_,classes,correct_class", + ("type_", "classes", "correct_class"), [(t, [YAMLDataLoader], YAMLDataLoader) for t in PrimitiveTypes], ) def test_resolve_correct_loader_class( @@ -78,7 +78,7 @@ def test_resolve_correct_loader_class( @pytest.mark.parametrize( - "type_,classes,correct_class", + ("type_", "classes", "correct_class"), [(t, [YAMLDataSaver], YAMLDataSaver) for t in PrimitiveTypes], ) def test_resolve_correct_saver_class( diff --git a/tests/test_base.py b/tests/test_base.py index 17b485d2..6c9d6406 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -78,7 +78,7 @@ class _Foo: @pytest.mark.parametrize( - "outputs,expected_result", + ("outputs", "expected_result"), [ ({"a": 1}, pd.DataFrame([{"a": 1}])), ({"a": pd.Series([1, 2, 3])}, pd.DataFrame({"a": pd.Series([1, 2, 3])})), @@ -227,7 +227,7 @@ def test_PandasDataFrameResult_build_result_errors(outputs): @pytest.mark.parametrize( - "outputs,expected_result", + ("outputs", "expected_result"), [ ( { @@ -301,7 +301,7 @@ PD_VERSION = version.parse(pd.__version__) @pytest.mark.parametrize( - "outputs,expected_result", + ("outputs", "expected_result"), [ ({"a": pd.Series([1, 2, 3])}, ({"RangeIndex:::int64": ["a"]}, {}, {})), ( @@ -378,7 +378,7 @@ def test_PandasDataFrameResult_pandas_index_types(outputs, expected_result): @pytest.mark.parametrize( - "all_index_types,time_indexes,no_indexes,expected_result", + ("all_index_types", "time_indexes", "no_indexes", "expected_result"), [ ({"foo": ["a", "b", "c"]}, {}, {}, True), ({"int-index": ["a"], "no-index": ["b"]}, {}, {"no-index": ["b"]}, True), @@ -409,7 +409,7 @@ def test_PandasDataFrameResult_check_pandas_index_types_match( @pytest.mark.parametrize( - "outputs,expected_result", + ("outputs", "expected_result"), [ ({"a": pd.Series([1, 2, 3])}, pd.DataFrame({"a": pd.Series([1, 2, 3])})), ( diff --git a/tests/test_common.py b/tests/test_common.py index 65d93a95..7d73f1e0 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -31,7 +31,7 @@ class Object: @pytest.mark.parametrize( - "value_to_convert, module_set, expected_value, expected_error", + ("value_to_convert", "module_set", "expected_value", "expected_error"), [ ("a", {"amodule"}, "a", None), ( diff --git a/tests/test_default_data_quality.py b/tests/test_default_data_quality.py index bb7da2b2..924442e1 100644 --- a/tests/test_default_data_quality.py +++ b/tests/test_default_data_quality.py @@ -41,7 +41,7 @@ from tests.resources.dq_dummy_examples import ( @pytest.mark.parametrize( - "output_type, kwargs, importance, expected", + ("output_type", "kwargs", "importance", "expected"), [ (int, {"equal_to": 1}, "warn", [SampleDataValidator1(importance="warn", equal_to=1)]), (int, {"equal_to": 5}, "fail", [SampleDataValidator1(importance="fail", equal_to=5)]), @@ -79,7 +79,7 @@ def test_resolve_default_validators(output_type, kwargs, importance, expected): @pytest.mark.parametrize( - "output_type, kwargs, importance", + ("output_type", "kwargs", "importance"), [(str, {"dataset_length": 1}, "warn"), (pd.Series, {"equal_to": 1}, "warn")], ) def test_resolve_default_validators_error(output_type, kwargs, importance): @@ -93,7 +93,7 @@ def test_resolve_default_validators_error(output_type, kwargs, importance): @pytest.mark.parametrize( - "cls,param,data,should_pass", + ("cls", "param", "data", "should_pass"), [ ( default_validators.DataInRangeValidatorPandasSeries, diff --git a/tests/test_dev_utils.py b/tests/test_dev_utils.py index d8613602..b423d172 100644 --- a/tests/test_dev_utils.py +++ b/tests/test_dev_utils.py @@ -23,7 +23,7 @@ from hamilton.dev_utils.deprecation import DeprecationError, Version, deprecated @pytest.mark.parametrize( - "version_1, version_2, op", + ("version_1", "version_2", "op"), [ (Version(0, 1, 2), Version(0, 1, 2), operator.eq), (Version(0, 1, 2), Version(0, 1, 3), operator.lt), @@ -37,7 +37,8 @@ def test_version_compare(version_1, version_2, op): @pytest.mark.parametrize( - "version_tuple,version", [((0, 1, 2), Version(0, 1, 2)), ((0, 1, 2, "rc1"), Version(0, 1, 2))] + ("version_tuple", "version"), + [((0, 1, 2), Version(0, 1, 2)), ((0, 1, 2, "rc1"), Version(0, 1, 2))], ) def test_from_version_tuple(version_tuple, version): assert Version.from_version_tuple(version_tuple) == version diff --git a/tests/test_end_to_end.py b/tests/test_end_to_end.py index ff2f9c6f..bd401a69 100644 --- a/tests/test_end_to_end.py +++ b/tests/test_end_to_end.py @@ -130,7 +130,7 @@ def modify_and_import(module_name, package, modification_func): @pytest.mark.parametrize( - "driver_factory,future_import_annotations", + ("driver_factory", "future_import_annotations"), [ (lambda modules: driver.Driver({"region": "US"}, *modules), False), ( diff --git a/tests/test_graph.py b/tests/test_graph.py index 19c8132b..5a6c4016 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -780,7 +780,7 @@ def test_function_graph_display_content(tmp_path: pathlib.Path): @pytest.mark.parametrize( - "filename, keep_dot", [("dag", False), ("dag.png", False), ("dag", True), ("dag.png", True)] + ("filename", "keep_dot"), [("dag", False), ("dag.png", False), ("dag", True), ("dag.png", True)] ) def test_function_graph_display_output_filename( tmp_path: pathlib.Path, filename: str, keep_dot: bool @@ -915,7 +915,7 @@ def test_function_graph_display_orient(orient: str): assert f"rankdir={orient}" in dot.source [email protected]("hide_inputs", [(True,), (False,)]) [email protected]("hide_inputs", [True, False]) def test_function_graph_display_inputs(hide_inputs: bool): config = {"b": 1, "c": 2} fg = graph.FunctionGraph.from_modules(tests.resources.dummy_functions, config=config) @@ -949,7 +949,7 @@ def test_function_graph_display_without_saving(): assert isinstance(digraph, graphviz.Digraph) [email protected]("display_fields", [(True,), (False,)]) [email protected]("display_fields", [True, False]) def test_function_graph_display_fields(display_fields: bool): @schema.output(("foo", "int"), ("bar", "float"), ("baz", "str")) def df_with_schema() -> pd.DataFrame: @@ -1172,7 +1172,7 @@ def test_end_to_end_with_generics(): @pytest.mark.parametrize( - "config,inputs,overrides", + ("config", "inputs", "overrides"), [ # testing with no provided inputs ({}, {}, {}), diff --git a/tests/test_hamilton_driver.py b/tests/test_hamilton_driver.py index cd088a32..95b645f1 100644 --- a/tests/test_hamilton_driver.py +++ b/tests/test_hamilton_driver.py @@ -154,7 +154,7 @@ def test_driver_variables_exposes_tags(): @pytest.mark.parametrize( - "filter,expected", + ("filter", "expected"), [ (None, {"a", "b_c", "b", "c", "d"}), # no filter ({}, {"a", "b_c", "b", "c", "d"}), # empty filter diff --git a/tests/test_node.py b/tests/test_node.py index e77600ea..45bd62c1 100644 --- a/tests/test_node.py +++ b/tests/test_node.py @@ -99,7 +99,7 @@ def test_node_handles_annotated(): @pytest.mark.parametrize( - "tags, query, expected", + ("tags", "query", "expected"), [ ({}, {"module": "tests.resources.tagging"}, False), ({"module": "tests.resources.tagging"}, {}, True), diff --git a/tests/test_parallel_graceful.py b/tests/test_parallel_graceful.py index aa5f823b..0c329dc2 100644 --- a/tests/test_parallel_graceful.py +++ b/tests/test_parallel_graceful.py @@ -56,7 +56,7 @@ def _make_driver( @pytest.mark.parametrize( - "test_state, try_parallel, fail_first, expected_value", + ("test_state", "try_parallel", "fail_first", "expected_value"), [ ("early", True, False, [None]), ("middle", True, False, [0.0, 6.0, 12.0, 18.0, 24.0, None]), diff --git a/tests/test_telemetry.py b/tests/test_telemetry.py index c04f6108..52ba2878 100644 --- a/tests/test_telemetry.py +++ b/tests/test_telemetry.py @@ -171,7 +171,7 @@ class CustomResultBuilder(base.ResultMixin): @pytest.mark.parametrize( - "adapter, expected", + ("adapter", "expected"), [ ( base.SimplePythonDataFrameGraphAdapter(), @@ -195,7 +195,7 @@ def test_get_adapter_name(adapter, expected): @pytest.mark.parametrize( - "adapter, expected", + ("adapter", "expected"), [ (base.SimplePythonDataFrameGraphAdapter(), "hamilton.base.PandasDataFrameResult"), (base.DefaultAdapter(), "hamilton.base.DictResult"), diff --git a/tests/test_type_utils.py b/tests/test_type_utils.py index 9931b246..cd970225 100644 --- a/tests/test_type_utils.py +++ b/tests/test_type_utils.py @@ -38,7 +38,7 @@ custom_type = typing.TypeVar("FOOBAR") @pytest.mark.parametrize( - "param_type,requested_type,expected", + ("param_type", "requested_type", "expected"), [ (custom_type, custom_type, True), (custom_type, typing.TypeVar("FOO"), False), @@ -93,7 +93,7 @@ def test_custom_subclass_check(param_type, requested_type, expected): @pytest.mark.parametrize( - "param_type,required_type,expected", + ("param_type", "required_type", "expected"), [ (typing.TypeVar("FOO"), typing.TypeVar("BAR"), False), (custom_type, custom_type, True), @@ -147,7 +147,7 @@ def test_validate_types_sad(type_): @pytest.mark.parametrize( - "candidate,type_,expected", + ("candidate", "type_", "expected"), [ (int, int, True), # a class is always a subclass of itself. (int, float, False), @@ -211,7 +211,7 @@ def test_type_as_string_with_annotated_type(): @pytest.mark.parametrize( - "node_type,input_value", + ("node_type", "input_value"), [ (pd.DataFrame, pd.Series([1, 2, 3])), (list, {}), @@ -249,7 +249,7 @@ T = typing.TypeVar("T") @pytest.mark.parametrize( - "node_type,input_value", + ("node_type", "input_value"), [ (typing.Any, None), (pd.Series, pd.Series([1, 2, 3])), diff --git a/ui/backend/server/tests/test_db_methods/test_permissions.py b/ui/backend/server/tests/test_db_methods/test_permissions.py index 83df89df..656596cc 100644 --- a/ui/backend/server/tests/test_db_methods/test_permissions.py +++ b/ui/backend/server/tests/test_db_methods/test_permissions.py @@ -87,7 +87,7 @@ async def test_user_can_create_api_key(db): @pytest.mark.asyncio @pytest.mark.parametrize( - "user,allowed", + ("user", "allowed"), [ ("user_individual@no_team.com", True), ("user_with_no_permissions@no_one_invited_me.com", False), @@ -210,9 +210,9 @@ async def test_user_has_visibility_when_granted_individual_access(role: str, db) await ProjectUserMembership.objects.acreate(project=project, user=user, role=role) assert (await user_project_visibility(authenticated_request, project=project)) == role - @pytest.mark.asyncio @pytest.mark.parametrize("role", ["read", "write"]) [email protected]("role", ["read", "write"]) async def test_user_does_not_have_visibility_when_not_granted_individual_access(role: str, db): authenticated_request = await _get_authenticated_request( "user_with_no_permissions@no_one_invited_me.com" @@ -330,7 +330,7 @@ async def test_users_can_always_get_projects(db): @pytest.mark.asyncio [email protected]("role,allowed", [("read", False), ("write", True)]) [email protected](("role","allowed"), [("read", False), ("write", True)]) async def test_user_can_edit_project_by_id_visibility_role(role: str, allowed: bool, db): authenticated_request = await _get_authenticated_request("[email protected]") user, teams = authenticated_request.auth @@ -429,13 +429,10 @@ async def test_user_cannot_get_dag_template_with_no_access(db): @pytest.mark.asyncio [email protected]( - "role", - [ - "read", - "write", - ], -) [email protected]("role", [ + "read", + "write", +]) async def test_user_can_get_dag_templates_with_access(db, role): ( dag_template, @@ -462,7 +459,7 @@ async def test_user_cannot_get_dag_templates_with_no_access(db): @pytest.mark.asyncio [email protected]("role,allowed", [("read", False), ("write", True)]) [email protected](("role","allowed"), [("read", False), ("write", True)]) async def test_user_can_write_to_dag_template_with_access(db, role, allowed): ( dag_template, @@ -515,7 +512,7 @@ async def _setup_project_dag_template_and_run( @pytest.mark.asyncio @pytest.mark.parametrize( - "role,allowed", + ("role", "allowed"), [ ("read", False), ("write", True), @@ -589,7 +586,7 @@ async def test_user_cannot_get_dag_run_with_no_access(db): @pytest.mark.asyncio @pytest.mark.parametrize( - "role,by,allowed", + ("role", "by", "allowed"), [ ("read", "project_id", True), ("write", "project_id", True),
