diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 330849e26..abb8c56f3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: additional_dependencies: [-e, 'git+git://github.com/pycqa/pyflakes.git@1911c20#egg=pyflakes'] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.781 + rev: v0.790 hooks: - id: mypy args: [--strict] diff --git a/.stubs/pytest.pyi b/.stubs/pytest.pyi deleted file mode 100644 index 2f9a183a2..000000000 --- a/.stubs/pytest.pyi +++ /dev/null @@ -1 +0,0 @@ -def __getattr__(name): ... # type: ignore diff --git a/requirements/dev.txt b/requirements/dev.txt index 5f9cc5fa8..12c60af95 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -3,7 +3,7 @@ black coveralls flake8 isort~=5.0 -mypy==0.781 +mypy==0.790 nox pre-commit pyflakes diff --git a/tests/conftest.py b/tests/conftest.py index c3711da3e..304282e4d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,7 +6,7 @@ from omegaconf.basecontainer import BaseContainer -@pytest.fixture(scope="function") # type: ignore +@pytest.fixture(scope="function") def restore_resolvers() -> Any: """ A fixture to restore singletons state after this the function. diff --git a/tests/examples/test_postponed_annotations.py b/tests/examples/test_postponed_annotations.py index c3c222a88..2171c6430 100644 --- a/tests/examples/test_postponed_annotations.py +++ b/tests/examples/test_postponed_annotations.py @@ -3,7 +3,7 @@ import pytest -@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires Python 3.7") # type: ignore +@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires Python 3.7") def test_simple_types_class_postponed() -> None: # import from a module which has `from __future__ import annotations` from .dataclass_postponed_annotations import simple_types_class @@ -11,7 +11,7 @@ def test_simple_types_class_postponed() -> None: simple_types_class() -@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires Python 3.7") # type: ignore +@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires Python 3.7") def test_conversions_postponed() -> None: # import from a module which has `from __future__ import annotations` from .dataclass_postponed_annotations import conversions diff --git a/tests/structured_conf/test_structured_config.py b/tests/structured_conf/test_structured_config.py index 25342ceaa..190d80e01 100644 --- a/tests/structured_conf/test_structured_config.py +++ b/tests/structured_conf/test_structured_config.py @@ -259,7 +259,7 @@ def validate(cfg: DictConfig) -> None: conf = OmegaConf.structured(module.ConfigWithDict()) validate(conf) - @pytest.mark.parametrize( # type:ignore + @pytest.mark.parametrize( "tested_type,assignment_data, init_dict", [ # Use class to build config @@ -331,7 +331,7 @@ def validate(input_: Any, expected: Any) -> None: validate(input_class, input_class()) validate(input_class(**init_dict), input_class(**init_dict)) - @pytest.mark.parametrize( # type: ignore + @pytest.mark.parametrize( "input_init, expected_init", [ # attr class as class @@ -403,7 +403,7 @@ def test_interpolation(self, class_type: str) -> Any: assert type(conf.z1) == int assert type(conf.z2) == str - @pytest.mark.parametrize( # type: ignore + @pytest.mark.parametrize( "tested_type", [ "BoolOptional", @@ -575,9 +575,7 @@ def test_typed_list_value_error(self, class_type: str) -> None: with pytest.raises(ValidationError): OmegaConf.structured(input_) - @pytest.mark.parametrize( # type: ignore - "example", ["ListExamples", "TupleExamples"] - ) + @pytest.mark.parametrize("example", ["ListExamples", "TupleExamples"]) def test_list_examples(self, class_type: str, example: str) -> None: module: Any = import_module(class_type) input_ = getattr(module, example) @@ -783,7 +781,9 @@ def test_set_list_correct_type(self, class_type: str) -> None: assert cfg.list == value assert cfg.tuple == value - @pytest.mark.parametrize("value", [1, True, "str", 3.1415, ["foo", True, 1.2], User()]) # type: ignore + @pytest.mark.parametrize( + "value", [1, True, "str", 3.1415, ["foo", True, 1.2], User()] + ) def test_assign_wrong_type_to_list(self, class_type: str, value: Any) -> None: module: Any = import_module(class_type) cfg = OmegaConf.structured(module.ListClass) @@ -793,7 +793,7 @@ def test_assign_wrong_type_to_list(self, class_type: str, value: Any) -> None: cfg.tuple = value assert cfg == OmegaConf.structured(module.ListClass) - @pytest.mark.parametrize( # type: ignore + @pytest.mark.parametrize( "value", [ 1, @@ -1090,7 +1090,7 @@ def test_merge_into_none_dict(self, class_type: str) -> None: assert OmegaConf.merge(cfg, cfg) == cfg - @pytest.mark.parametrize( # type: ignore + @pytest.mark.parametrize( "update_value,expected", [ pytest.param([], {"list": []}, id="empty"), diff --git a/tests/test_base_config.py b/tests/test_base_config.py index fc343d26f..0a758437b 100644 --- a/tests/test_base_config.py +++ b/tests/test_base_config.py @@ -23,7 +23,7 @@ from . import Color, StructuredWithMissing, User, does_not_raise -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_, key, value, expected", [ # dict @@ -49,7 +49,7 @@ def test_set_value( assert c == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_, key, value", [ # dict @@ -64,7 +64,7 @@ def test_set_value_validation_fail(input_: Any, key: Any, value: Any) -> None: c[key] = value -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_, key, value", [ # dict @@ -82,7 +82,7 @@ def test_replace_value_node_type_with_another( assert c[key] == value._value() -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_", [ pytest.param([1, 2, 3], id="list"), @@ -112,7 +112,7 @@ def assert_container_with_primitives(item: Any) -> None: assert_container_with_primitives(res) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg,ex_false,ex_true", [ pytest.param( @@ -141,7 +141,7 @@ def test_exclude_structured_configs(cfg: Any, ex_false: Any, ex_true: Any) -> No assert ret1 == ex_true -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "src, expected, expected_with_resolve", [ pytest.param([], None, None, id="empty_list"), @@ -219,7 +219,7 @@ def test_string_interpolation_with_readonly_parent() -> None: } -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "src,expected", [ pytest.param(DictConfig(content="${bar}"), "${bar}", id="DictConfig"), @@ -235,7 +235,7 @@ def test_to_container_missing_inter_no_resolve(src: Any, expected: Any) -> None: assert res == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_, is_empty", [ ([], True), @@ -249,8 +249,8 @@ def test_empty(input_: Any, is_empty: bool) -> None: assert c.is_empty() == is_empty -@pytest.mark.parametrize("func", [str, repr]) # type: ignore -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize("func", [str, repr]) +@pytest.mark.parametrize( "input_, expected", [ pytest.param([], "[]", id="list"), @@ -277,7 +277,7 @@ def test_str(func: Any, input_: Any, expected: str) -> None: assert string == expected -@pytest.mark.parametrize("flag", ["readonly", "struct"]) # type: ignore +@pytest.mark.parametrize("flag", ["readonly", "struct"]) def test_flag_dict(flag: str) -> None: c = OmegaConf.create() assert c._get_flag(flag) is None @@ -289,7 +289,7 @@ def test_flag_dict(flag: str) -> None: assert c._get_flag(flag) is None -@pytest.mark.parametrize("flag", ["readonly", "struct"]) # type: ignore +@pytest.mark.parametrize("flag", ["readonly", "struct"]) def test_freeze_nested_dict(flag: str) -> None: c = OmegaConf.create(dict(a=dict(b=2))) assert not c._get_flag(flag) @@ -393,7 +393,7 @@ def test_deepcopy_and_merge_and_flags() -> None: OmegaConf.merge(c2, OmegaConf.from_dotlist(["dataset.bad_key=yes"])) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg", [ListConfig(element_type=int, content=[]), DictConfig(content={})] ) def test_deepcopy_preserves_container_type(cfg: Container) -> None: @@ -401,7 +401,7 @@ def test_deepcopy_preserves_container_type(cfg: Container) -> None: assert cp._metadata.element_type == cfg._metadata.element_type -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "src, flag_name, func, expectation", [ pytest.param( @@ -458,7 +458,7 @@ def test_multiple_flags_override() -> None: c.foo = 20 -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "src, func, expectation", [ ({}, lambda c: c.__setitem__("foo", 1), raises(ReadonlyConfigError)), @@ -477,7 +477,7 @@ def test_read_write_override(src: Any, func: Any, expectation: Any) -> None: func(c) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "string, tokenized", [ ("dog,cat", ["dog", "cat"]), @@ -497,7 +497,7 @@ def test_tokenize_with_escapes(string: str, tokenized: List[str]) -> None: assert OmegaConf._tokenize_args(string) == tokenized -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "src, func, expectation", [({}, lambda c: c.__setattr__("foo", 1), raises(AttributeError))], ) @@ -513,7 +513,7 @@ def test_struct_override(src: Any, func: Any, expectation: Any) -> None: func(c) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "flag_name,ctx", [("struct", open_dict), ("readonly", read_write)] ) def test_open_dict_restore(flag_name: str, ctx: Any) -> None: @@ -532,7 +532,7 @@ def test_open_dict_restore(flag_name: str, ctx: Any) -> None: @pytest.mark.parametrize("copy_method", [lambda x: copy.copy(x), lambda x: x.copy()]) class TestCopy: - @pytest.mark.parametrize( # type: ignore + @pytest.mark.parametrize( "src", [[], [1, 2], ["a", "b", "c"], {}, {"a": "b"}, {"a": {"b": []}}] ) def test_copy(self, copy_method: Any, src: Any) -> None: @@ -541,7 +541,7 @@ def test_copy(self, copy_method: Any, src: Any) -> None: assert id(src) != id(cp) assert src == cp - @pytest.mark.parametrize( # type: ignore + @pytest.mark.parametrize( "src,interpolating_key,interpolated_key", [([1, 2, "${0}"], 2, 0), ({"a": 10, "b": "${a}"}, "b", "a")], ) @@ -575,7 +575,7 @@ def test_not_implemented() -> None: OmegaConf() -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "query, result", [ ("a", "a"), @@ -605,7 +605,7 @@ def test_omegaconf_create() -> None: assert OmegaConf.create(10) # type: ignore -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "parent, key, value, expected", [ ([10, 11], 0, ["a", "b"], [["a", "b"], 11]), @@ -622,7 +622,7 @@ def test_assign(parent: Any, key: Union[str, int], value: Any, expected: Any) -> assert c == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg, key, expected", [ # dict diff --git a/tests/test_basic_ops_dict.py b/tests/test_basic_ops_dict.py index 75f7f5da9..7641dde50 100644 --- a/tests/test_basic_ops_dict.py +++ b/tests/test_basic_ops_dict.py @@ -151,9 +151,9 @@ def test_scientific_notation_float() -> None: assert 10e-3 == c.a -@pytest.mark.parametrize("struct", [None, True, False]) # type: ignore -@pytest.mark.parametrize("default_val", [4, True, False, None]) # type: ignore -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize("struct", [None, True, False]) +@pytest.mark.parametrize("default_val", [4, True, False, None]) +@pytest.mark.parametrize( "d,select,key", [ ({"hello": {"a": 2}}, "", "missing"), @@ -273,7 +273,7 @@ def test_iterate_dict_with_interpolation() -> None: i = i + 1 -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg, key, default_, expected", [ pytest.param({"a": 1, "b": 2}, "a", "__NO_DEFAULT__", 1, id="no_default"), @@ -355,7 +355,7 @@ def test_dict_structured_mode_pop() -> None: assert "name" not in cfg.user -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg, key, expectation", [ ({"a": 1, "b": 2}, "not_found", pytest.raises(KeyError)), @@ -373,7 +373,7 @@ def test_dict_pop_error(cfg: Dict[Any, Any], key: Any, expectation: Any) -> None assert c == cfg -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "conf,key,expected", [ ({"a": 1, "b": {}}, "a", True), @@ -459,9 +459,7 @@ def test_dict_nested_structured_delitem() -> None: assert "name" not in c.user -@pytest.mark.parametrize( # type: ignore - "d, expected", [({}, 0), ({"a": 10, "b": 11}, 2)] -) +@pytest.mark.parametrize("d, expected", [({}, 0), ({"a": 10, "b": 11}, 2)]) def test_dict_len(d: Any, expected: Any) -> None: c = OmegaConf.create(d) assert len(c) == expected @@ -501,7 +499,7 @@ def test_instantiate_config_fails() -> None: BaseContainer() # type: ignore -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg, key, expected", [ ({"a": 1, "b": 2, "c": 3}, None, ["a", "b", "c"]), @@ -525,14 +523,14 @@ def test_hash() -> None: assert hash(c1) != hash(c2) -@pytest.mark.parametrize("default", ["default", 0, None]) # type: ignore +@pytest.mark.parametrize("default", ["default", 0, None]) def test_get_with_default_from_struct_not_throwing(default: Any) -> None: c = OmegaConf.create({"a": 10, "b": 20}) OmegaConf.set_struct(c, True) assert c.get("z", default) == default -@pytest.mark.parametrize("cfg", [{"foo": {}}, [1, 2, 3]]) # type: ignore +@pytest.mark.parametrize("cfg", [{"foo": {}}, [1, 2, 3]]) def test_members(cfg: Any) -> None: # Make sure accessing __members__ does not return None or throw. c = OmegaConf.create(cfg) @@ -540,7 +538,7 @@ def test_members(cfg: Any) -> None: c.__members__ -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "in_cfg, mask_keys, expected", [ ({}, [], {}), @@ -645,7 +643,7 @@ def test_get_type() -> None: assert OmegaConf.get_type(cfg.inter) == User -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg, expected_ref_type", [ ( @@ -700,15 +698,15 @@ def test_is_missing() -> None: assert cfg._get_node("missing_node_inter")._is_missing() # type:ignore -@pytest.mark.parametrize("ref_type", [None, Any]) # type: ignore -@pytest.mark.parametrize("assign", [None, {}, {"foo": "bar"}, [1, 2, 3]]) # type: ignore +@pytest.mark.parametrize("ref_type", [None, Any]) +@pytest.mark.parametrize("assign", [None, {}, {"foo": "bar"}, [1, 2, 3]]) def test_assign_to_reftype_none_or_any(ref_type: Any, assign: Any) -> None: cfg = OmegaConf.create({"foo": DictConfig(ref_type=ref_type, content={})}) cfg.foo = assign assert cfg.foo == assign -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "ref_type,values,assign,expectation", [ (Plugin, [None, "???", Plugin], None, does_not_raise), @@ -787,7 +785,7 @@ def test_setdefault() -> None: assert cfg["foo"] == 10 -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "c", [ pytest.param({"a": ListConfig([1, 2, 3], ref_type=list)}, id="list_value"), diff --git a/tests/test_basic_ops_list.py b/tests/test_basic_ops_list.py index 47cb7648b..ae425950d 100644 --- a/tests/test_basic_ops_list.py +++ b/tests/test_basic_ops_list.py @@ -37,7 +37,7 @@ def test_list_get_with_default() -> None: assert c.get(2, "default_value") == "found" -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_, expected, list_key", [ pytest.param([1, 2], [1, 2], None, id="simple"), @@ -153,7 +153,7 @@ def test_list_delitem() -> None: validate_list_keys(c) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "lst,expected", [ (OmegaConf.create([1, 2]), 2), @@ -187,7 +187,7 @@ def test_list_append() -> None: validate_list_keys(c) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "lc,element,expected", [ pytest.param( @@ -252,7 +252,7 @@ def test_append_invalid_element_type( lc.append(element) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "lc,element,expected", [ pytest.param( @@ -282,7 +282,7 @@ def test_append_convert(lc: ListConfig, element: Any, expected: Any) -> None: assert type(value) == type(expected) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "index, expected", [(slice(1, 3), [11, 12]), (slice(0, 3, 2), [10, 12]), (-1, 13)] ) def test_list_index(index: Any, expected: Any) -> None: @@ -290,7 +290,7 @@ def test_list_index(index: Any, expected: Any) -> None: assert c[index] == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg, expected", [ (OmegaConf.create([1, 2, 3]), ["0", "1", "2"]), @@ -308,7 +308,7 @@ def validate_list_keys(c: Any) -> None: assert c._get_node(i)._metadata.key == i -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_, index, value, expected, expected_node_type, expectation", [ (["a", "b", "c"], 1, 100, ["a", 100, "b", "c"], AnyNode, None), @@ -358,7 +358,7 @@ def test_insert( validate_list_keys(c) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "lst,idx,value,expectation", [ (ListConfig(content=None), 0, 10, pytest.raises(TypeError)), @@ -370,7 +370,7 @@ def test_insert_special_list(lst: Any, idx: Any, value: Any, expectation: Any) - lst.insert(idx, value) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "src, append, result", [ ([], [], []), @@ -384,7 +384,7 @@ def test_extend(src: List[Any], append: List[Any], result: List[Any]) -> None: assert lst == result -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "src, remove, result, expectation", [ ([10], 10, [], does_not_raise()), @@ -401,8 +401,8 @@ def test_remove(src: List[Any], remove: Any, result: Any, expectation: Any) -> N assert lst == result -@pytest.mark.parametrize("src", [[], [1, 2, 3], [None, dict(foo="bar")]]) # type: ignore -@pytest.mark.parametrize("num_clears", [1, 2]) # type: ignore +@pytest.mark.parametrize("src", [[], [1, 2, 3], [None, dict(foo="bar")]]) +@pytest.mark.parametrize("num_clears", [1, 2]) def test_clear(src: List[Any], num_clears: int) -> None: lst = OmegaConf.create(src) for i in range(num_clears): @@ -410,7 +410,7 @@ def test_clear(src: List[Any], num_clears: int) -> None: assert lst == [] -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "src, item, expected_index, expectation", [ ([], 20, -1, pytest.raises(ValueError)), @@ -438,7 +438,7 @@ def test_index_with_range() -> None: lst.index(x=30, end=2) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "src, item, count", [([], 10, 0), ([10], 10, 1), ([10, 2, 10], 10, 2), ([10, 2, 10], None, 0)], ) @@ -534,7 +534,7 @@ def test_set_with_invalid_key() -> None: cfg["foo"] = 4 # type: ignore -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "lst,idx,expected", [ (OmegaConf.create([1, 2]), 0, 1), @@ -550,7 +550,7 @@ def test_getitem(lst: Any, idx: Any, expected: Any) -> None: assert lst.__getitem__(idx) == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "sli", [ (slice(None, None, None)), @@ -573,7 +573,7 @@ def test_getitem_slice(sli: slice) -> None: assert olst.__getitem__(sli) == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "lst,idx,expected", [ (OmegaConf.create([1, 2]), 0, 1), diff --git a/tests/test_config_eq.py b/tests/test_config_eq.py index 6bb5e019d..a2f3d65a2 100644 --- a/tests/test_config_eq.py +++ b/tests/test_config_eq.py @@ -7,7 +7,7 @@ from . import Group, User -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "i1,i2", [ # === LISTS === @@ -106,7 +106,7 @@ def eq(a: Any, b: Any) -> None: eq(c2, i2) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input1, input2", [ # Dicts diff --git a/tests/test_create.py b/tests/test_create.py index 2ff07904e..bb78622aa 100644 --- a/tests/test_create.py +++ b/tests/test_create.py @@ -13,7 +13,7 @@ from . import ConcretePlugin, IllegalType, NonCopyableIllegalType, Plugin -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_,expected", [ # No content @@ -47,14 +47,14 @@ (OmegaConf.create({}), {}), (OmegaConf.create([]), []), (OmegaConf.create({"foo": OmegaConf.create([])}), {"foo": []}), - (OmegaConf.create([OmegaConf.create({})]), [{}]), # type: ignore + (OmegaConf.create([OmegaConf.create({})]), [{}]), ], ) def test_create_value(input_: Any, expected: Any) -> None: assert OmegaConf.create(input_) == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_", [ # top level dict @@ -82,7 +82,7 @@ def test_create_allow_objects(input_: Any) -> None: assert cfg == input_ -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_", [ # top level dict @@ -110,7 +110,7 @@ def test_create_allow_objects_non_copyable(input_: Any) -> None: assert cfg == input_ -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_", [ pytest.param({"foo": "bar"}, id="dict"), @@ -144,7 +144,7 @@ def test_cli_passing() -> None: assert {"a": 1, "b": {"c": 2}} == c -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_,expected", [ # simple @@ -214,7 +214,7 @@ def test_create_from_listconfig_preserves_metadata() -> None: assert cfg1._metadata == cfg2._metadata -@pytest.mark.parametrize("node", [({"bar": 10}), ([1, 2, 3])]) # type: ignore +@pytest.mark.parametrize("node", [({"bar": 10}), ([1, 2, 3])]) def test_create_node_parent_retained_on_create(node: Any) -> None: cfg1 = OmegaConf.create({"foo": node}) cfg2 = OmegaConf.create({"zonk": cfg1.foo}) diff --git a/tests/test_errors.py b/tests/test_errors.py index cf88a4d6f..a00cc7da6 100644 --- a/tests/test_errors.py +++ b/tests/test_errors.py @@ -1094,9 +1094,7 @@ def create_readonly(cfg: Any) -> Any: return cfg -@pytest.mark.parametrize( # type:ignore - "expected", params -) +@pytest.mark.parametrize("expected", params) def test_errors(expected: Expected, monkeypatch: Any) -> None: monkeypatch.setenv("OC_CAUSE", "0") cfg = expected.create() @@ -1109,6 +1107,7 @@ def test_errors(expected: Expected, monkeypatch: Any) -> None: # helps in debugging raise e ex = einfo.value + assert isinstance(ex, OmegaConfBaseException) assert ex.object_type == expected.object_type assert ex.key == expected.key diff --git a/tests/test_get_full_key.py b/tests/test_get_full_key.py index 1aef2a104..1c70013c9 100644 --- a/tests/test_get_full_key.py +++ b/tests/test_get_full_key.py @@ -7,7 +7,7 @@ from . import Color -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg, select, key, expected", [ ({}, "", "a", "a"), diff --git a/tests/test_interpolation.py b/tests/test_interpolation.py index 007b88ad1..c7ec63c1e 100644 --- a/tests/test_interpolation.py +++ b/tests/test_interpolation.py @@ -11,7 +11,7 @@ from omegaconf.errors import ConfigKeyError -@pytest.mark.parametrize( # type:ignore +@pytest.mark.parametrize( "cfg,key,expected", [ pytest.param({"a": "${b}", "b": 10}, "a", 10, id="simple"), @@ -151,7 +151,7 @@ def test_indirect_interpolation2() -> None: } -@pytest.mark.parametrize( # type:ignore +@pytest.mark.parametrize( "cfg", [ pytest.param({"a": "${b}", "b": "string", "s": "foo_${b}"}, id="str"), @@ -166,7 +166,7 @@ def test_type_inherit_type(cfg: Any) -> None: assert type(cfg.s) == str # check that string interpolations are always strings -@pytest.mark.parametrize( # type:ignore +@pytest.mark.parametrize( "cfg,env_name,env_val,key,expected", [ pytest.param( @@ -225,7 +225,7 @@ def test_env_interpolation( assert OmegaConf.select(cfg, key) == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "value,expected", [ # bool @@ -319,7 +319,7 @@ def test_resolver_dot_start(restore_resolvers: Any) -> None: assert c.foo_dot == ".bar" -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "resolver,name,key,result", [ (lambda *args: args, "arg_list", "${my_resolver:cat, dog}", ("cat", "dog")), @@ -402,7 +402,7 @@ def test_incremental_dict_with_interpolation() -> None: assert conf.b.c == conf.a # type:ignore -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg,node_key,key,expected", [ pytest.param({"a": 10}, "", "", ({"a": 10}, "")), diff --git a/tests/test_merge.py b/tests/test_merge.py index 2d78e47af..0832d4603 100644 --- a/tests/test_merge.py +++ b/tests/test_merge.py @@ -35,7 +35,7 @@ ) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "inputs, expected", [ # dictionaries @@ -310,9 +310,7 @@ def test_primitive_dicts() -> None: assert merged == {"a": 10, "b": 20} -@pytest.mark.parametrize( # type: ignore - "a_, b_, expected", [((1, 2, 3), (4, 5, 6), [4, 5, 6])] -) +@pytest.mark.parametrize("a_, b_, expected", [((1, 2, 3), (4, 5, 6), [4, 5, 6])]) def test_merge_no_eq_verify( a_: Tuple[int], b_: Tuple[int], expected: Tuple[int] ) -> None: @@ -323,7 +321,7 @@ def test_merge_no_eq_verify( assert expected == c -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "c1,c2,expected", [({}, {"a": 1, "b": 2}, {"a": 1, "b": 2}), ({"a": 1}, {"b": 2}, {"a": 1, "b": 2})], ) @@ -334,7 +332,7 @@ def test_merge_with(c1: Any, c2: Any, expected: Any) -> None: assert a == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "c1,c2,expected", [({}, {"a": 1, "b": 2}, {"a": 1, "b": 2}), ({"a": 1}, {"b": 2}, {"a": 1, "b": 2})], ) @@ -362,7 +360,7 @@ def test_merge_list_list() -> None: assert a == b -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "base, merge, exception", [ ({}, [], TypeError), @@ -379,7 +377,7 @@ def test_merge_error(base: Any, merge: Any, exception: Any) -> None: OmegaConf.merge(base, merge) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "c1, c2", [ pytest.param({"foo": "bar"}, {"zoo": "foo"}, id="dict"), @@ -394,7 +392,7 @@ def test_with_readonly_c1(c1: Any, c2: Any) -> None: assert OmegaConf.is_readonly(cfg3) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "c1, c2", [ pytest.param({"foo": "bar"}, {"zoo": "foo"}, id="dict"), @@ -409,7 +407,7 @@ def test_with_readonly_c2(c1: Any, c2: Any) -> None: assert OmegaConf.is_readonly(cfg3) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "c1, c2", [({"foo": "bar"}, {"zoo": "foo"}), ([1, 2, 3], [4, 5, 6])] ) def test_into_readonly(c1: Any, c2: Any) -> None: @@ -419,7 +417,7 @@ def test_into_readonly(c1: Any, c2: Any) -> None: cfg.merge_with(c2) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "c1, c2, expected", [ ( @@ -440,7 +438,7 @@ def test_dict_merge_readonly_into_readwrite(c1: Any, c2: Any, expected: Any) -> assert c1 == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "c1, c2, expected", [({"node": [1, 2, 3]}, {"node": [4, 5, 6]}, {"node": [4, 5, 6]})], ) @@ -467,7 +465,7 @@ def test_parent_maintained() -> None: assert id(c3.a._get_parent()) == id(c3) -@pytest.mark.parametrize( # type:ignore +@pytest.mark.parametrize( "cfg,overrides,expected", [ ([1, 2, 3], ["0=bar", "2.a=100"], ["bar", 2, dict(a=100)]), @@ -492,7 +490,7 @@ def test_merge_with_cli() -> None: assert c == ["bar", 2, dict(a=100)] -@pytest.mark.parametrize( # type:ignore +@pytest.mark.parametrize( "dotlist, expected", [([], {}), (["foo=1"], {"foo": 1}), (["foo=1", "bar"], {"foo": 1, "bar": None})], ) @@ -502,7 +500,7 @@ def test_merge_empty_with_dotlist(dotlist: List[str], expected: Dict[str, Any]) assert c == expected -@pytest.mark.parametrize("dotlist", ["foo=10", ["foo=1", 10]]) # type:ignore +@pytest.mark.parametrize("dotlist", ["foo=10", ["foo=1", 10]]) def test_merge_with_dotlist_errors(dotlist: List[str]) -> None: c = OmegaConf.create() with pytest.raises(ValueError): @@ -520,7 +518,7 @@ def test_merge_allow_objects() -> None: assert ret == {"a": 10, "foo": iv} -@pytest.mark.parametrize( # type:ignore +@pytest.mark.parametrize( "dst, other, expected, node", [ pytest.param( @@ -546,7 +544,7 @@ def test_merge_with_src_as_interpolation( assert res == expected -@pytest.mark.parametrize( # type:ignore +@pytest.mark.parametrize( "dst, other, node", [ pytest.param( @@ -568,7 +566,7 @@ def test_merge_with_other_as_interpolation(dst: Any, other: Any, node: Any) -> N assert OmegaConf.is_interpolation(res, node) -@pytest.mark.parametrize( # type:ignore +@pytest.mark.parametrize( ("c1", "c2"), [ pytest.param( diff --git a/tests/test_nodes.py b/tests/test_nodes.py index a4501ad6f..e1669e60c 100644 --- a/tests/test_nodes.py +++ b/tests/test_nodes.py @@ -22,7 +22,7 @@ # testing valid conversions -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "type_,input_,output_", [ # string @@ -81,7 +81,7 @@ def test_valid_inputs(type_: type, input_: Any, output_: Any) -> None: # testing invalid conversions -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "type_,input_", [ (IntegerNode, "abc"), @@ -123,7 +123,7 @@ def test_invalid_inputs(type_: type, input_: Any) -> None: type_(input_) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_, expected_type", [ ({}, DictConfig), @@ -199,7 +199,7 @@ def test_list_integer_rejects_string() -> None: # Test merge raises validation error -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "c1, c2", [ (dict(a=IntegerNode(10)), dict(a="str")), @@ -218,7 +218,7 @@ def test_merge_validation_error(c1: Dict[str, Any], c2: Dict[str, Any]) -> None: assert conf2 == OmegaConf.create(c2) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "type_,valid_value, invalid_value", [ (IntegerNode, 1, "invalid"), @@ -261,10 +261,10 @@ class Enum2(Enum): NOT_BAR = 2 -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "type_", [BooleanNode, EnumNode, FloatNode, IntegerNode, StringNode, AnyNode] ) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "values, success_map", [ ( @@ -332,7 +332,7 @@ def test_legal_assignment( type_(value) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "node,value", [ (IntegerNode(), "foo"), @@ -346,10 +346,10 @@ def test_illegal_assignment(node: ValueNode, value: Any) -> None: node._set_value(value) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "node_type", [BooleanNode, EnumNode, FloatNode, IntegerNode, StringNode, AnyNode] ) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "enum_type, values, success_map", [ ( @@ -384,8 +384,8 @@ class DummyEnum(Enum): FOO = 1 -@pytest.mark.parametrize("is_optional", [True, False]) # type: ignore -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize("is_optional", [True, False]) +@pytest.mark.parametrize( "ref_type, type_, value, expected_type", [ (Any, Any, 10, AnyNode), @@ -439,7 +439,7 @@ class UserClass: ) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "obj", [ StringNode(), @@ -462,7 +462,7 @@ def test_deepcopy(obj: Any) -> None: assert obj.__dict__[k] == cp.__dict__[k] -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "node, value, expected", [ (StringNode(), None, True), @@ -508,7 +508,7 @@ def test_eq(node: ValueNode, value: Any, expected: Any) -> None: assert (node.__hash__() == value.__hash__()) == expected -@pytest.mark.parametrize("value", [1, 3.14, True, None, Enum1.FOO]) # type: ignore +@pytest.mark.parametrize("value", [1, 3.14, True, None, Enum1.FOO]) def test_set_anynode_with_primitive_type(value: Any) -> None: cfg = OmegaConf.create({"a": 5}) a_before = cfg._get_node("a") @@ -518,7 +518,7 @@ def test_set_anynode_with_primitive_type(value: Any) -> None: assert cfg.a == value -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "value, container_type", [ (ListConfig(content=[1, 2]), ListConfig), diff --git a/tests/test_omegaconf.py b/tests/test_omegaconf.py index 8e017023d..b49e80b35 100644 --- a/tests/test_omegaconf.py +++ b/tests/test_omegaconf.py @@ -20,7 +20,7 @@ from . import Color, ConcretePlugin, IllegalType, StructuredWithMissing, does_not_raise -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg, key, expected_is_missing, expectation", [ ({}, "foo", False, does_not_raise()), @@ -108,7 +108,7 @@ def test_is_missing_resets() -> None: assert OmegaConf.is_missing(cfg, "list") -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg, expected", [ (None, False), @@ -131,7 +131,7 @@ def test_is_config(cfg: Any, expected: bool) -> None: assert OmegaConf.is_config(cfg) == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg, expected", [ (None, False), @@ -154,7 +154,7 @@ def test_is_list(cfg: Any, expected: bool) -> None: assert OmegaConf.is_list(cfg) == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg, expected", [ (None, False), @@ -177,8 +177,8 @@ def test_is_dict(cfg: Any, expected: bool) -> None: assert OmegaConf.is_dict(cfg) == expected -@pytest.mark.parametrize("is_optional", [True, False]) # type: ignore -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize("is_optional", [True, False]) +@pytest.mark.parametrize( "fac", [ ( @@ -242,8 +242,8 @@ def test_is_optional(fac: Any, is_optional: bool) -> None: assert OmegaConf.is_optional(cfg, "node") == is_optional -@pytest.mark.parametrize("is_none", [True, False]) # type: ignore -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize("is_none", [True, False]) +@pytest.mark.parametrize( "fac", [ (lambda none: StringNode(value="foo" if not none else None, is_optional=True)), @@ -285,7 +285,7 @@ def test_is_none(fac: Any, is_none: bool) -> None: @pytest.mark.parametrize( - "fac", # type: ignore + "fac", [ ( lambda inter: StringNode( @@ -343,7 +343,7 @@ def test_is_none(fac: Any, is_none: bool) -> None: "ConcretePlugin", ], ) -def test_is_interpolation(fac): +def test_is_interpolation(fac: Any) -> Any: obj = fac(inter=None) assert not OmegaConf.is_interpolation(obj) cfg = OmegaConf.create({"node": obj}) @@ -358,7 +358,7 @@ def test_is_interpolation(fac): assert OmegaConf.is_interpolation(cfg, "node") -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg, type_", [ ({"foo": 10}, int), @@ -379,7 +379,7 @@ def test_get_type(cfg: Any, type_: Any) -> None: assert OmegaConf.get_type(cfg, "foo") == type_ -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "obj, type_", [ (10, int), diff --git a/tests/test_readonly.py b/tests/test_readonly.py index fbd1dff19..7a45c450a 100644 --- a/tests/test_readonly.py +++ b/tests/test_readonly.py @@ -7,7 +7,7 @@ from omegaconf import DictConfig, ListConfig, OmegaConf, ReadonlyConfigError -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "src, func, expectation", [ pytest.param( @@ -80,7 +80,7 @@ def test_readonly( assert c == src -@pytest.mark.parametrize("src", [{}, []]) # type: ignore +@pytest.mark.parametrize("src", [{}, []]) def test_readonly_flag(src: Union[Dict[str, Any], List[Any]]) -> None: c = OmegaConf.create(src) assert not OmegaConf.is_readonly(c) @@ -183,7 +183,7 @@ def test_readonly_from_cli() -> None: assert OmegaConf.is_readonly(cfg2) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg1, cfg2", [ pytest.param({"foo": {"bar": 10}}, {"foo": {"bar": 20}}, id="override_value"), @@ -199,7 +199,7 @@ def test_merge_with_readonly(cfg1: Dict[str, Any], cfg2: Dict[str, Any]) -> None c.merge_with(cfg2) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "readonly_key, cfg1, cfg2, expected", [ pytest.param( diff --git a/tests/test_select.py b/tests/test_select.py index 7f4d7a1cb..68780476d 100644 --- a/tests/test_select.py +++ b/tests/test_select.py @@ -9,14 +9,14 @@ from omegaconf._utils import _ensure_container -@pytest.mark.parametrize("struct", [True, False, None]) # type: ignore +@pytest.mark.parametrize("struct", [True, False, None]) def test_select_key_from_empty(struct: Optional[bool]) -> None: c = OmegaConf.create() OmegaConf.set_struct(c, struct) assert OmegaConf.select(c, "not_there") is None -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg, key, expected", [ pytest.param({}, "nope", None, id="dict:none"), @@ -51,9 +51,9 @@ def test_select(restore_resolvers: Any, cfg: Any, key: Any, expected: Any) -> No assert OmegaConf.select(cfg, key) == expected -@pytest.mark.parametrize("struct", [False, True]) # type: ignore -@pytest.mark.parametrize("default", [10, None]) # type: ignore -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize("struct", [False, True]) +@pytest.mark.parametrize("default", [10, None]) +@pytest.mark.parametrize( "cfg, key", [ pytest.param({}, "not_found", id="empty"), @@ -72,9 +72,9 @@ def test_select_default( assert OmegaConf.select(cfg, key, default=default) == default -@pytest.mark.parametrize("struct", [False, True]) # type: ignore -@pytest.mark.parametrize("default", [10, None]) # type: ignore -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize("struct", [False, True]) +@pytest.mark.parametrize("default", [10, None]) +@pytest.mark.parametrize( "cfg, key", [ pytest.param({"missing": "???"}, "missing", id="missing"), @@ -94,7 +94,7 @@ def test_select_default_throw_on_missing( OmegaConf.select(cfg, key, default=default, throw_on_missing=True) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( ("cfg", "node_key", "expected"), [ pytest.param({"foo": "${bar}", "bar": 10}, "foo", 10, id="simple"), diff --git a/tests/test_serialization.py b/tests/test_serialization.py index a842ecb5a..a09168b0c 100644 --- a/tests/test_serialization.py +++ b/tests/test_serialization.py @@ -126,7 +126,7 @@ def test_save_illegal_type() -> None: OmegaConf.save(OmegaConf.create(), 1000) # type: ignore -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "obj,ref_type", [ ({"a": "b"}, Dict[Union[str, Enum], Any]), @@ -198,7 +198,7 @@ def test_load_empty_file(tmpdir: str) -> None: assert OmegaConf.load(f) == {} -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_,node,element_type,key_type,optional,ref_type", [ (UntypedList, "list", Any, Any, False, List[Any]), diff --git a/tests/test_struct.py b/tests/test_struct.py index 9a90a8e47..5282675ba 100644 --- a/tests/test_struct.py +++ b/tests/test_struct.py @@ -43,7 +43,7 @@ def test_merge_dotlist_into_struct() -> None: c.merge_with_dotlist(["foo=1"]) -@pytest.mark.parametrize("in_base, in_merged", [(dict(), dict(a=10))]) # type: ignore +@pytest.mark.parametrize("in_base, in_merged", [(dict(), dict(a=10))]) def test_merge_config_with_struct( in_base: Dict[str, Any], in_merged: Dict[str, Any] ) -> None: diff --git a/tests/test_to_yaml.py b/tests/test_to_yaml.py index 3d9d7faac..f0c56cf20 100644 --- a/tests/test_to_yaml.py +++ b/tests/test_to_yaml.py @@ -9,7 +9,7 @@ from . import Enum1, User -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_, expected", [ (["item1", "item2", {"key3": "value3"}], "- item1\n- item2\n- key3: value3\n"), @@ -24,7 +24,7 @@ def test_to_yaml(input_: Any, expected: str) -> None: assert OmegaConf.create(OmegaConf.to_yaml(c)) == c -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_, expected", [ (["item一", "item二", dict(key三="value三")], "- item一\n- item二\n- key三: value三\n"), @@ -37,7 +37,7 @@ def test_to_yaml_unicode(input_: Any, expected: str) -> None: assert OmegaConf.create(OmegaConf.to_yaml(c)) == c -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_, expected, type_", [ (["1", 1], "- '1'\n- 1\n", int), @@ -59,7 +59,7 @@ def test_to_yaml_string_primitive_types_list( assert OmegaConf.to_yaml(c) == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_, expected, type_", [ ({"b": "1", "a": 1}, "b: '1'\na: 1\n", int), @@ -79,7 +79,7 @@ def test_to_yaml_string_primitive_types_dict( assert OmegaConf.to_yaml(c) == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "input_, resolve, expected", [ (dict(a1="${ref}", ref="bar"), True, "bar"), @@ -143,7 +143,7 @@ def test_pretty_deprecated() -> None: assert c.pretty() == "foo: bar\n" -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "user", [ User(name="Bond", age=7), diff --git a/tests/test_update.py b/tests/test_update.py index 5b4d0e3cb..52cfb0b4c 100644 --- a/tests/test_update.py +++ b/tests/test_update.py @@ -10,7 +10,7 @@ from tests import Package -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg,key,value,expected", [ # dict @@ -88,7 +88,7 @@ def test_update(cfg: Any, key: str, value: Any, expected: Any) -> None: assert cfg == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "cfg,key,value,merge,expected", [ pytest.param( diff --git a/tests/test_utils.py b/tests/test_utils.py index adb319195..1d8b0c5d1 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -21,7 +21,7 @@ from . import Color, ConcretePlugin, IllegalType, Plugin, does_not_raise -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "target_type, value, expected", [ # Any @@ -150,7 +150,7 @@ class _TestUserClass: pass -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "type_, expected", [ (int, True), @@ -171,7 +171,7 @@ def test_valid_value_annotation_type(type_: type, expected: bool) -> None: assert valid_value_annotation_type(type_) == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "test_cls_or_obj, expectation", [ (_TestDataclass, does_not_raise()), @@ -193,7 +193,7 @@ def test_get_structured_config_data(test_cls_or_obj: Any, expectation: Any) -> N assert d["dict1"] == {} -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "test_cls", [ _TestDataclassIllegalValue, @@ -246,7 +246,7 @@ class Dataclass: pass -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "value,kind", [ ("foo", _utils.ValueKind.VALUE), @@ -285,7 +285,7 @@ def validate(cfg1: DictConfig) -> None: cfg._get_node("str")._set_parent(None) # type:ignore cfg._get_node("list")._set_parent(None) # type:ignore - cfg.list._get_node(0)._set_parent(None) # type: ignore + cfg.list._get_node(0)._set_parent(None) # type:ignore # noinspection PyProtectedMember cfg._re_parent() validate(cfg) @@ -304,7 +304,7 @@ def test_get_class() -> None: _utils._get_class("tests.examples.test_dataclass_example.not_found") -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "key_type,expected_key_type", [ (str, str), @@ -312,7 +312,7 @@ def test_get_class() -> None: (Any, Any), ], ) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "value_type,expected_value_type", [ (int, int), @@ -324,14 +324,14 @@ def test_get_class() -> None: def test_get_key_value_types( key_type: Any, expected_key_type: Any, value_type: Any, expected_value_type: Any ) -> None: - dt = Dict[key_type, value_type] # type: ignore + dt = Dict[key_type, value_type] # type:ignore assert _utils.get_dict_key_value_types(dt) == ( expected_key_type, expected_value_type, ) -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "type_, is_primitive", [ (int, True), @@ -350,8 +350,8 @@ def test_is_primitive_type(type_: Any, is_primitive: bool) -> None: assert _utils.is_primitive_type(type_) == is_primitive -@pytest.mark.parametrize("optional", [False, True]) # type: ignore -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize("optional", [False, True]) +@pytest.mark.parametrize( "type_, expected", [ (int, "int"), @@ -388,7 +388,7 @@ def test_type_str_none() -> None: assert _utils.type_str(None) == "NoneType" -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "type_, expected", [ (Optional[int], "Optional[int]"), @@ -401,7 +401,7 @@ def test_type_str_union(type_: Any, expected: str) -> None: assert _utils.type_str(type_) == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "type_, expected", [ (Dict[str, int], True), @@ -421,7 +421,7 @@ def test_is_dict_annotation(type_: Any, expected: Any) -> Any: assert is_dict_annotation(type_=type_) == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "type_, expected", [ (List[int], True), @@ -442,7 +442,7 @@ def test_is_list_annotation(type_: Any, expected: Any) -> Any: assert is_list_annotation(type_=type_) == expected -@pytest.mark.parametrize( # type: ignore +@pytest.mark.parametrize( "obj, expected", [ # Unwrapped values