This PR improves the stream2py codebase by enhancing test coverage, fixing several bugs, implementing the closed property feature, and providing comprehensive analysis of all open issues.
- Python 3.11+ compatibility: Fixed
test_util.pyto handle bothTypeErrorandAttributeErrorfor context manager protocol violations - QuickSourceReader bug: Added missing
open_instanceattribute that was referenced ininfoproperty but never set - SimpleSourceReader bug: Fixed to return
Noneinstead of raisingStopIterationwhen data is exhausted - Documentation: Fixed syntax error in
__init__.pydocstring (missing colon in property definition)
- Closed property (#6): Implemented
closedproperty forSourceReadersimilar toio.IOBase.closed- Added
_closedattribute to track open/close state - Updated
__enter__and__exit__to manage the flag - Updated
QuickSourceReaderto properly set closed state - Added docstring examples demonstrating usage
- Added
- BufferReader blocking tests: Added comprehensive tests for the
blockingparameter- Tests for
blocking=Trueandblocking=Falsebehavior - Tests for blocking read when buffer stops
- Tests for
- QuickSourceReader tests: Added 6 new tests covering:
- Basic functionality
- Context manager usage
- Info property
- Key method
- Iteration behavior
- Custom
is_valid_datafiltering
- ISSUE_ANALYSIS.md: Created comprehensive analysis of all 17 open issues
- Categorized by status: already resolved, simple fixes, medium effort, complex/ongoing, external
- Identified dependencies and relationships between issues
- Provided resolution recommendations for each
- Documented that #20 is already resolved and #8 is partially resolved
- Before: 11 tests (1 failing)
- After: 19 tests (all passing)
- Coverage: +8 new tests added
- Resolves #6 (closed property for SourceReader)
- Documents #20 as already resolved (blocking parameter exists in BufferReader.read())
- Documents #8 as partially resolved (blocking exists, timeout could be added)
stream2py/__init__.py- Fixed docstring syntax errorstream2py/source_reader.py- Added closed property, fixed QuickSourceReader bugstream2py/tests/test_util.py- Fixed Python 3.11+ compatibilitystream2py/tests/utils_for_testing.py- Fixed SimpleSourceReader StopIteration handlingstream2py/tests/test_buffer_reader_blocking.py- New test file for blocking parameterstream2py/tests/test_quick_source_reader.py- New test file for QuickSourceReaderISSUE_ANALYSIS.md- New comprehensive issue analysis document
None - all changes are backward compatible.
- All tests passing (19/19)
- Documentation updated
- Backward compatible
- Issue analysis completed
- Code formatted
See ISSUE_ANALYSIS.md for recommended next steps and prioritization of remaining issues.