Adds Tests for Various Lists Functions by jeremylow · Pull Request #291 · bear/python-twitter · GitHub
Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Adds Tests for Various Lists Functions#291

Merged
jeremylow merged 19 commits into
masterfrom
tests_lists
Jan 31, 2016
Merged

Adds Tests for Various Lists Functions#291
jeremylow merged 19 commits into
masterfrom
tests_lists

Conversation

@jeremylow

Copy link
Copy Markdown
Collaborator

Like it says on the tin -- adds a bunch of tests for the List functions and refactors/fixes some of the old stuff that didn't get picked up before with py3 compatibility. There are a couple things of note:

  • Some methods, namely GetListsList don't require a user_id or screen_name parameter -- if neither is passed, then the data will be for the authenticated user.
  • New methods/functions: type checking can be done with enf_type, which takes the name of the field, the type the field should be, and the value to convert and raises the appropriate errors if it cannot be done. So instead of:
    try:
        parameters['count'] = int(count)
    except ValueError:
        raise TwitterError({'message': '"count" must be an integer'})

it's just:

    parameters['count'] = enf_type('count', int, count)

The error raised is largely similar, it tells you the name of the field that was incorrect and the expected type. This isn't standard across the API since I wanted to keep this PR to just the List functions, but that's a todo I guess if it seems rational.

  • Refactored out ID'ing a specific list into its own static method _IDList() which takes the list-y kwargs and figures out how the user is trying to identify a list (i.e., by id or slug + (user_id/screen_name).

I think that's about it, but I've seen the word "list" about a million times these two days and I'm sure I missed something.

I also alphabetized the migration guide.

Review on Reviewable

@bear

bear commented Jan 31, 2016

Copy link
Copy Markdown
Owner

jeremylow added a commit that referenced this pull request Jan 31, 2016
Adds Tests for Various Lists Functions
@jeremylow jeremylow merged commit 2e952ff into master Jan 31, 2016
@jeremylow

Copy link
Copy Markdown
Collaborator Author

@jeremylow jeremylow deleted the tests_lists branch January 31, 2016 19:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants