-
Notifications
You must be signed in to change notification settings - Fork 27
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
Added a way to get encounters per Pokémon #44
base: master
Are you sure you want to change the base?
Added a way to get encounters per Pokémon #44
Conversation
Codecov Report
@@ Coverage Diff @@
## master #44 +/- ##
==========================================
- Coverage 99.81% 99.72% -0.09%
==========================================
Files 3 3
Lines 1099 1105 +6
==========================================
+ Hits 1097 1102 +5
- Misses 2 3 +1
Continue to review full report at Codecov.
|
Thanks for the contributions! I like the addition of listing the encounters. Shouldn't a list always be returned? So we are always consistent. What do you think? |
Do you mean for the whole API (all the If you meant just for |
Just for |
Hey GeoffreyFrogeye, thanks for the PR! You just made me realize that the This question aside, I've started to work on hypermedia resources a while ago, which would handle attributes linking to other resources. In short, I think you did well with this PR, I just think it will become obsolete when hypermedia resources handling is correctly implemented. |
Other comments:
You mean swapping the names of the
The tests check if all |
Because the current behavior is to return a list only if its length is two or more. When When Maybe the
It's even better if it's replaced by something clean! This was just a quick modification for me, I did not expect this submission to be long-lived.
Yes. I find it confusing, having worked with APIs that use the opposite convention. I guess it should be discussed on the API project, not here. I haven't looked into that yet. |
This is intended behaviour as the majority of PokéAPI resources and subresources return just one object, so having a list with a single element didn't make much sense. For those cases where more than one object is returned, then yes, they are returned in a list.
True. I don't think that check is needed.
This should be discussed on the pokeapi repo, yes |
I did, and also merged it here just in case you'd want to merge this before merging pagination. If not, feel free to close this PR.
Honestly this is so minor that I don't want to bother people with that. I finally got used to it. |
I'll leave this open for now |
Hi, basically because we needed a very quick solution to address a big problem. At that time the API was overloaded. All the requests to retrieve the I guess that we could go back now. |
The function is called
get_location_area
to stay consistent with the API but this is a bit weird.If it were up to me I'd swap
PokemonEncounter
andLocationAreaEncounter
so the name matches the anchor point of the encounter and not the attributes inside. What do you think?I also added a
always_list
attribute so it stills give a list even if there's only one encounter location. This might be rendered obsolete with a proper pagination implementation though.Pagination implementation will also render obsolete testing done for this feature so I didn't really put much thought in it. Furthermore, I didn't really understood the way the tests were made (it only checks a string?).
I couldn't test this on others versions of Python because
tox
was throwing an error I gave up trying to fix. Sorry about that.