Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ failOnWarnings = true
reportAny = false
reportArgumentType = false
reportAssignmentType = false
reportAttributeAccessIssue = false
reportCallInDefaultInitializer = false
reportExplicitAny = false
reportImplicitOverride = false
Expand Down
2 changes: 1 addition & 1 deletion tests/usethis/_file/ini/test_ini_io_.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def relative_path(self) -> Path:
change_cwd(tmp_path),
MyINIFileManager() as manager,
):
manager._content = 42 # type: ignore
manager._content = ConfigUpdater()
with pytest.raises(UnexpectedINIIOError):
manager.read_file()

Expand Down
6 changes: 4 additions & 2 deletions tests/usethis/_file/toml/test_toml_io_.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,13 @@ def relative_path(self) -> Path:
with change_cwd(tmp_path):
manager = MyTOMLFileManager()

expected = tomlkit.TOMLDocument()

# Act
manager._content = 42 # type: ignore
manager._content = expected

# Assert
assert manager._content == 42
assert manager._content == expected

def test_set_high_levels_of_nesting(self, tmp_path: Path) -> None:
# Arrange
Expand Down
9 changes: 0 additions & 9 deletions tests/usethis/_python/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,3 @@ def test_unequal_patch(self):

# Act & Assert
assert v1 != v2

class TestImmutability:
def test_frozen_dataclass(self):
# Arrange
version = PythonVersion(major="3", minor="13")

# Act & Assert
with pytest.raises(AttributeError):
version.major = "4" # type: ignore[misc]
21 changes: 12 additions & 9 deletions tests/usethis/_tool/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1424,9 +1424,9 @@ def test_tool_without_selection_support(self) -> None:
file_manager = MagicMock()
tool = MockToolForRuleTests(file_manager=file_manager, selected_rules=[])
# Override to simulate a tool without selection support
tool._get_select_keys = lambda fm: super( # type: ignore[method-assign]
tool._get_select_keys = lambda file_manager: super( # type: ignore[method-assign]
MockToolForRuleTests, tool
)._get_select_keys(fm)
)._get_select_keys(file_manager)

# Act & Assert
with pytest.raises(
Expand Down Expand Up @@ -1489,13 +1489,16 @@ def test_it_returns_false(self) -> None:
def test_tool_without_selection_support(self) -> None:
# Arrange
file_manager = MagicMock()
tool = MockToolForRuleTests(
file_manager=file_manager, selected_rules=["E501"]
)
# Override to simulate a tool without selection support
tool._get_select_keys = lambda fm: super( # type: ignore[method-assign]
MockToolForRuleTests, tool
)._get_select_keys(fm)

class MyMock(MockToolForRuleTests):
def _get_select_keys(
self, file_manager: KeyValueFileManager
) -> list[str]:
return super(MockToolForRuleTests, self)._get_select_keys(
file_manager
)

tool = MyMock(file_manager=file_manager, selected_rules=["E501"])

# Act & Assert
with pytest.raises(
Expand Down