-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Overview
This is a sub-task of #119 - Refactor: Address Law of Demeter violations for better encapsulation
Priority: Medium
Pattern: Test code directly accessing _private attributes of classes under test
Violations Found
80+ instances found across test files, including:
transport._initialized(multiple test files)transport._sys.stdin.readline(test_transport.py)transport._lock(test_stdio.py)executor._semaphore(test_executor.py)safety_filter._sanitize_string_argument()(test_safety.py)
Why It's a Problem
- Tests are coupled to implementation details
- Violates encapsulation
- Makes code harder to maintain
- Reduces test value
Refactoring Strategies
Test through public API only, or add test helper methods if absolutely necessary.
Acceptance Criteria
- Audit all test files for private attribute access
- Categorize violations by necessity
- Refactor tests to use public API where possible
- Add test helper methods only where truly necessary
- Document testing patterns in contributor guide
- All tests pass after refactoring
References
Metadata
Metadata
Assignees
Labels
No labels
Projects
Status
Todo