Commit 8304148
committed
refactor: Refactor V3 parsers to dedicated _parsers module with comprehensive test coverage
Reorganize V3 boxscore parsers into a dedicated `_parsers/` module following
separation of concerns and improving maintainability. All parsers now follow a
consistent pattern with comprehensive test coverage using TDD approach.
Changes:
- Move existing parsers (boxscoreadvancedv3, boxscoretraditionalv3) to _parsers/
- Add 6 new parsers with complete implementations:
- boxscoredefensivev2: Defensive statistics (deflections, charges, etc.)
- boxscorefourfactorsv3: Four factors analysis (eFG%, TO%, etc.)
- boxscorehustlev2: Hustle stats (contested shots, loose balls, etc.)
- boxscoremiscv3: Miscellaneous stats (points off turnovers, etc.)
- boxscoreplayertrackv3: Player tracking (distance, speed, touches, etc.)
- boxscorescoringv3: Scoring breakdowns (2PT, 3PT, paint, etc.)
- boxscoreusagev3: Usage percentages and possession distribution
- Create parser registry in _parsers/__init__.py with register_parser() function
- Fix circular import in http.py using lazy parser loading
- Add 7 test suites with 86 comprehensive unit tests (all passing)
- Add Python test fixtures (not JSON files) for all parsers
- Add API response documentation in docs/nba_api/stats/endpoints/responses/
All parsers:
- Return headers as lists (not tuples) for API compatibility
- Follow consistent metadata patterns (team, player, statistics)
- Handle missing/incomplete data gracefully
- Include comprehensive test coverage (initialization, headers, data extraction)
Test results: 329 total unit tests passing (86 new parser tests)
Code quality: All files formatted with black/isort, linted with flake81 parent aed2f96 commit 8304148
File tree
36 files changed
+10490
-1094
lines changed- docs/nba_api/stats/endpoints/responses
- src/nba_api/stats
- endpoints/_parsers
- library
- tests/unit/stats/endpoints
- data
36 files changed
+10490
-1094
lines changedLines changed: 922 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 657 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 556 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 793 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 735 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 965 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 738 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 847 additions & 0 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | 22 | | |
| 23 | + | |
17 | 24 | | |
18 | 25 | | |
19 | 26 | | |
| |||
22 | 29 | | |
23 | 30 | | |
24 | 31 | | |
25 | | - | |
26 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
27 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
28 | 40 | | |
29 | | - | |
| 41 | + | |
| 42 | + | |
30 | 43 | | |
| 44 | + | |
31 | 45 | | |
32 | 46 | | |
33 | 47 | | |
| |||
36 | 50 | | |
37 | 51 | | |
38 | 52 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
43 | 57 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
47 | 61 | | |
48 | 62 | | |
49 | | - | |
| 63 | + | |
50 | 64 | | |
51 | 65 | | |
52 | 66 | | |
| |||
0 commit comments