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

Types: add Status field #24

Open
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@glasserc
Contributor

glasserc commented Mar 2, 2015

This is one attempt at trying to address #20. It probably isn't the best approach, but it was simple to implement.

According to the Twitter API docs at e.g. https://dev.twitter.com/rest/reference/get/users/lookup, a user can
have a "status" field corresponding to their last posted status (assuming you can have permission to read it).

This PR introduces a new type called LastStatus which is very similar to Status but missing a few fields:

  • lastStatusUser, which doesn't seem to be present, perhaps because it's already "inside" a user object
  • lastStatusRetweetedStatus, which seems to cause the tests to go into an infinite loop (and I haven't seen attested)

I'm not exactly sure why lastStatusRetweetedStatus causes the tests to go into an infinite loop, but my hypothesis is that the values generated by QuickCheck are being generated in a way that makes them infinite. Specifically, I assume that each Maybe value gets generated randomly, perhaps with a 50% chance of coming up Just. A RetweetedStatus, has both a Status and a User, and the Status has a Maybe RetweetedStatus and a User, and a User has a Maybe LastStatus. So given a single RetweetedStatus, there are three Maybe values that need to be filled in; if each is filled in with 50% probability, then on average one-and-a-half values will be produced that need to be filled in. Removing the RetweetedStatus from the LastStatus drops the number of Maybes to one.

Other fields in LastStatus might or might not be attested; anything that was Maybe, I copied in just in case it should show up somewhere.

Types: add Status field
According to the Twitter API docs at
e.g. https://dev.twitter.com/rest/reference/get/users/lookup, a user can
have a "status" field corresponding to their last posted
status (assuming you can have permission to read it).
@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 2, 2015

Coverage Status

Coverage decreased (-0.97%) to 75.63% when pulling 892bd3d on glasserc:add-status into 97f8f00 on himura:master.

coveralls commented Mar 2, 2015

Coverage Status

Coverage decreased (-0.97%) to 75.63% when pulling 892bd3d on glasserc:add-status into 97f8f00 on himura:master.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 2, 2015

Coverage Status

Coverage decreased (-0.97%) to 75.63% when pulling de5bfae on glasserc:add-status into 97f8f00 on himura:master.

coveralls commented Mar 2, 2015

Coverage Status

Coverage decreased (-0.97%) to 75.63% when pulling de5bfae on glasserc:add-status into 97f8f00 on himura:master.

TypesTest: add more tests for LastStatus
Hopefully this will increase coverage.
@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 2, 2015

Coverage Status

Coverage increased (+0.06%) to 76.66% when pulling 985bbe1 on glasserc:add-status into 97f8f00 on himura:master.

coveralls commented Mar 2, 2015

Coverage Status

Coverage increased (+0.06%) to 76.66% when pulling 985bbe1 on glasserc:add-status into 97f8f00 on himura:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment