Fix #56: NameError when expand_attribute_column=False#68
Merged
Conversation
The else branch in read_gtf passed `result_df` to parse_gtf before `result_df` had been assigned — a guaranteed NameError that survived because the branch was never tested. Replaced with the correct `filepath_or_buffer` argument and also pass `split_attributes=False` so the unexpanded path doesn't emit the helper `attribute_split` column the user didn't ask for. Added tests/test_expand_attribute_column_false.py covering pandas / polars / dict result types, the features filter, and the alias / version-cast kwargs as graceful no-ops when attribute columns aren't expanded. Bumped to 2.7.1.
Coverage Report for CI Build 25819115218Coverage increased (+1.4%) to 95.215%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions2 previously-covered lines in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
`read_gtf(..., expand_attribute_column=False)` raised `NameError: name 'result_df' is not defined` because the else branch did:
```python
result_df = parse_gtf(result_df, features=features)
```
— referencing `result_df` on the right-hand side before it had been assigned. The branch was untested, which is why the bug survived. Fixed by passing the actual input (`filepath_or_buffer`) and threading `split_attributes=False` so the unexpanded path doesn't emit the `attribute_split` helper column the caller didn't ask for.
Bumps to 2.7.1.
Closes #56.
Test plan