Skip to content

Types: add Status field#24

Open
glasserc wants to merge 4 commits intohimura:masterfrom
glasserc:add-status
Open

Types: add Status field#24
glasserc wants to merge 4 commits intohimura:masterfrom
glasserc:add-status

Conversation

@glasserc
Copy link
Contributor

@glasserc 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.

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
Copy link

Coverage Status

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

@coveralls
Copy link

Coverage Status

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

Hopefully this will increase coverage.
@coveralls
Copy link

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants