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

[ERROR] AttributeError: 'NoneType' object has no attribute 'reverseHolofoil' #13

Open
ushmau5 opened this issue Jan 8, 2022 · 0 comments

Comments

@ushmau5
Copy link

ushmau5 commented Jan 8, 2022

As a software engineer,
I want to default the values for the TCGPrices and TCGPlayer objects,
So that there is less chance of Attribute errors.

Background:

I have noticed this exception frequently popping up;
[ERROR] AttributeError: 'NoneType' object has no attribute 'reverseHolofoil'
It appears that the TCGPrices object is None so when the reverseHolofoil property is accessed it throws an exception.

Example with this issue: 'set_code': 'pop4', 'id': '1', 'name': 'Chimecho (Delta Species)'

Proposed Solution:

Default the value of the prices attribute on the TCGPrices object to a TCGPrices object with None values for normal, holofoil, etc.

Default the value of tcgplayer attribute on the Card object to a TCGPlayer object.

@dataclass
class Card():
     ......
     tcgplayer: TCGPlayer = TCGPlayer()

@dataclass
class TCGPlayer():
     ....
    prices: TCGPrices = TCGPrices()

Test Scenarios

  • GIVEN a Card object WHEN I access the tcgplayer attribute THEN the value will always be a TCGPlayer object.
  • GIVEN a TCGPlayer object WHEN I access the prices attribute THEN the value will always be a TCGPrices object.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant