Skip to content

Commit 00ff3a4

Browse files
Enable reportAttributeAccessIssue in basedpyright
1 parent 97420c9 commit 00ff3a4

5 files changed

Lines changed: 17 additions & 22 deletions

File tree

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ failOnWarnings = true
210210
reportAny = false
211211
reportArgumentType = false
212212
reportAssignmentType = false
213-
reportAttributeAccessIssue = false
214213
reportCallInDefaultInitializer = false
215214
reportExplicitAny = false
216215
reportImplicitOverride = false

tests/usethis/_file/ini/test_ini_io_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def relative_path(self) -> Path:
103103
change_cwd(tmp_path),
104104
MyINIFileManager() as manager,
105105
):
106-
manager._content = 42 # type: ignore
106+
manager._content = ConfigUpdater()
107107
with pytest.raises(UnexpectedINIIOError):
108108
manager.read_file()
109109

tests/usethis/_file/toml/test_toml_io_.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,13 @@ def relative_path(self) -> Path:
122122
with change_cwd(tmp_path):
123123
manager = MyTOMLFileManager()
124124

125+
expected = tomlkit.TOMLDocument()
126+
125127
# Act
126-
manager._content = 42 # type: ignore
128+
manager._content = expected
127129

128130
# Assert
129-
assert manager._content == 42
131+
assert manager._content == expected
130132

131133
def test_set_high_levels_of_nesting(self, tmp_path: Path) -> None:
132134
# Arrange

tests/usethis/_python/test_version.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,3 @@ def test_unequal_patch(self):
199199

200200
# Act & Assert
201201
assert v1 != v2
202-
203-
class TestImmutability:
204-
def test_frozen_dataclass(self):
205-
# Arrange
206-
version = PythonVersion(major="3", minor="13")
207-
208-
# Act & Assert
209-
with pytest.raises(AttributeError):
210-
version.major = "4" # type: ignore[misc]

tests/usethis/_tool/test_base.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,9 +1424,9 @@ def test_tool_without_selection_support(self) -> None:
14241424
file_manager = MagicMock()
14251425
tool = MockToolForRuleTests(file_manager=file_manager, selected_rules=[])
14261426
# Override to simulate a tool without selection support
1427-
tool._get_select_keys = lambda fm: super( # type: ignore[method-assign]
1427+
tool._get_select_keys = lambda file_manager: super( # type: ignore[method-assign]
14281428
MockToolForRuleTests, tool
1429-
)._get_select_keys(fm)
1429+
)._get_select_keys(file_manager)
14301430

14311431
# Act & Assert
14321432
with pytest.raises(
@@ -1489,13 +1489,16 @@ def test_it_returns_false(self) -> None:
14891489
def test_tool_without_selection_support(self) -> None:
14901490
# Arrange
14911491
file_manager = MagicMock()
1492-
tool = MockToolForRuleTests(
1493-
file_manager=file_manager, selected_rules=["E501"]
1494-
)
1495-
# Override to simulate a tool without selection support
1496-
tool._get_select_keys = lambda fm: super( # type: ignore[method-assign]
1497-
MockToolForRuleTests, tool
1498-
)._get_select_keys(fm)
1492+
1493+
class MyMock(MockToolForRuleTests):
1494+
def _get_select_keys(
1495+
self, file_manager: KeyValueFileManager
1496+
) -> list[str]:
1497+
return super(MockToolForRuleTests, self)._get_select_keys(
1498+
file_manager
1499+
)
1500+
1501+
tool = MyMock(file_manager=file_manager, selected_rules=["E501"])
14991502

15001503
# Act & Assert
15011504
with pytest.raises(

0 commit comments

Comments
 (0)