Skip to content

Commit 1064dbf

Browse files
Enable reportArgumentType in basedpyright (#1305)
I'm removing a couple of the tests which aren't adding value since the type checker already protects against errors.
1 parent 25a116b commit 1064dbf

4 files changed

Lines changed: 1 addition & 30 deletions

File tree

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ rules.possibly-missing-attribute = "ignore"
207207
[tool.basedpyright]
208208
ignore = [ "src/usethis/_version.py" ]
209209
reportAny = false
210-
reportArgumentType = false
211210
reportAssignmentType = false
212211
reportAttributeAccessIssue = false
213212
reportCallInDefaultInitializer = false

src/usethis/_file/toml/io_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ def _set_value_in_existing(
402402
for key in reversed(unshared_keys[1:]):
403403
contents = {key: contents}
404404

405-
shared_container[keys[1]] = contents # type: ignore[reportAssignmentType]
405+
shared_container[keys[1]] = contents # pyright: ignore[reportArgumentType]
406406
else:
407407
shared_container[_get_unified_key(unshared_keys)] = value
408408

tests/usethis/_file/ini/test_ini_io_.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
INIStructureError,
1212
INIValueAlreadySetError,
1313
INIValueMissingError,
14-
InvalidINITypeError,
1514
UnexpectedINIIOError,
1615
UnexpectedINIOpenError,
1716
)
@@ -1471,26 +1470,6 @@ def relative_path(self) -> Path:
14711470
"""
14721471
)
14731472

1474-
def test_wrong_list_type_raises(self, tmp_path: Path):
1475-
# Arrange
1476-
class MyINIFileManager(INIFileManager):
1477-
@property
1478-
def relative_path(self) -> Path:
1479-
return Path("valid.ini")
1480-
1481-
valid_file = tmp_path / "valid.ini"
1482-
valid_file.touch()
1483-
1484-
# Act, Assert
1485-
with (
1486-
change_cwd(tmp_path),
1487-
MyINIFileManager() as manager,
1488-
pytest.raises(
1489-
InvalidINITypeError, match="INI files only support strings"
1490-
),
1491-
):
1492-
manager.extend_list(keys=["section", "key"], values=[123]) # type: ignore
1493-
14941473
class TestRemoveFromList:
14951474
def test_singleton_list_collapsed(self, tmp_path: Path):
14961475
# Arrange

tests/usethis/_integrations/pre_commit/test_yaml.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,3 @@ def test_placeholder(self, tmp_path: Path):
148148
),
149149
reference={},
150150
)
151-
152-
def test_invalid(self):
153-
with pytest.raises(TypeError):
154-
_pre_commit_fancy_dump(
155-
config=2, # type: ignore for test
156-
reference={},
157-
)

0 commit comments

Comments
 (0)