Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle missing player weights throwing errors #399

Merged
merged 1 commit into from
Apr 12, 2020

Conversation

roclark
Copy link
Owner

@roclark roclark commented Apr 12, 2020

If a player doesn't have a weight listed on his/her page, an AttributeError will be thrown while trying to call replace on an object of None. Simply checking if the weight is valid prior to attempting to replace the unit will prevent this error.

Fixes #393

Signed-Off-By: Robert Clark robdclark@outlook.com

@roclark roclark added the bug Something isn't working label Apr 12, 2020
@roclark roclark added this to the Release 0.6.0 milestone Apr 12, 2020
@roclark roclark self-assigned this Apr 12, 2020
@codecov
Copy link

codecov bot commented Apr 12, 2020

Codecov Report

Merging #399 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #399   +/-   ##
=======================================
  Coverage   99.97%   99.97%           
=======================================
  Files          48       48           
  Lines       10582    10590    +8     
=======================================
+ Hits        10579    10587    +8     
  Misses          3        3           
Impacted Files Coverage Δ
sportsreference/mlb/roster.py 100.00% <100.00%> (ø)
sportsreference/nba/roster.py 100.00% <100.00%> (ø)
sportsreference/nfl/roster.py 100.00% <100.00%> (ø)
sportsreference/nhl/roster.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 32cc99f...985e61d. Read the comment docs.

If a player doesn't have a weight listed on his/her page, an
AttributeError will be thrown while trying to call 'replace' on an
object of None. Simply checking if the weight is valid prior to
attempting to replace the unit will prevent this error.

Signed-Off-By: Robert Clark <robdclark@outlook.com>
@roclark roclark force-pushed the fix-nfl-invalid-player-weight branch from a935517 to 985e61d Compare April 12, 2020 22:01
@roclark roclark merged commit 15e70fb into master Apr 12, 2020
@roclark roclark deleted the fix-nfl-invalid-player-weight branch April 12, 2020 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'NoneType' object has no attribute 'replace'
1 participant