arturoqu / python-twitter

Automatically exported from code.google.com/p/python-twitter
Apache License 2.0
0 stars 0 forks source link

FAIL: Test the twitter.Status AsJsonString method #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Installed simplejson
2. Installed python twitter
3. Ran test script

23:57:02 python-twitter-0.5  : python twitter_test.py 
......................F.......F.....
======================================================================
FAIL: Test the twitter.Status AsJsonString method
----------------------------------------------------------------------
Traceback (most recent call last):
  File "twitter_test.py", line 121, in testAsJsonString
    self._GetSampleStatus().AsJsonString())
AssertionError: '{"created_at": "Fri Jan 26 23:17:14 +0000 2007", "id":
4391023, "text": "A l\\u00e9gp\\u00e1rn\\u00e1s haj\\u00f3m tele van
angoln\\u00e1kkal.", "user": {"description": "Canvas. JC Penny. Three
ninety-eight.", "id": 718443, "location": "Okinawa, Japan", "name": "Kesuke
Miyagi", "profile_image_url":
"http:\\/\\/twitter.com\\/system\\/user\\/profile_image\\/718443\\/normal\\/kesu
ke.png",
"screen_name": "kesuke", "url": "http:\\/\\/twitter.com\\/kesuke"}}' !=
'{"created_at": "Fri Jan 26 23:17:14 +0000 2007", "id": 4391023, "text": "A
l\\u00e9gp\\u00e1rn\\u00e1s haj\\u00f3m tele van angoln\\u00e1kkal.",
"user": {"description": "Canvas. JC Penny. Three ninety-eight.", "id":
718443, "location": "Okinawa, Japan", "name": "Kesuke Miyagi",
"profile_image_url":
"http://twitter.com/system/user/profile_image/718443/normal/kesuke.png",
"screen_name": "kesuke", "url": "http://twitter.com/kesuke"}}'

======================================================================
FAIL: Test the twitter.User AsJsonString method
----------------------------------------------------------------------
Traceback (most recent call last):
  File "twitter_test.py", line 224, in testAsJsonString
    self._GetSampleUser().AsJsonString())
AssertionError: '{"description": "Indeterminate things", "id": 673483,
"location": "San Francisco, CA", "name": "DeWitt", "profile_image_url":
"http:\\/\\/twitter.com\\/system\\/user\\/profile_image\\/673483\\/normal\\/me.j
pg",
"screen_name": "dewitt", "status": {"created_at": "Fri Jan 26 17:28:19
+0000 2007", "id": 4212713, "text": "\\"Select all\\" and archive your
Gmail inbox.  The page loads so much faster!"}, "url":
"http:\\/\\/unto.net\\/"}' != '{"description": "Indeterminate things",
"id": 673483, "location": "San Francisco, CA", "name": "DeWitt",
"profile_image_url":
"http://twitter.com/system/user/profile_image/673483/normal/me.jpg",
"screen_name": "dewitt", "status": {"created_at": "Fri Jan 26 17:28:19
+0000 2007", "id": 4212713, "text": "\\"Select all\\" and archive your
Gmail inbox.  The page loads so much faster!"}, "url": "http://unto.net/"}'

----------------------------------------------------------------------
Ran 36 tests in 0.128s

FAILED (failures=2)

Original issue reported on code.google.com by pobri...@gmail.com on 9 Sep 2008 at 3:57

GoogleCodeExporter commented 9 years ago

Original comment by dclinton on 9 Sep 2008 at 4:04

GoogleCodeExporter commented 9 years ago
I've experienced the same problem.

Original comment by odio....@gmail.com on 19 Sep 2008 at 11:28

GoogleCodeExporter commented 9 years ago
Me too.

Original comment by gavin.gi...@gmail.com on 4 Oct 2008 at 12:03

GoogleCodeExporter commented 9 years ago
What architecture, version of python, etc, are you guys using?

Original comment by dclinton on 4 Oct 2008 at 4:35

GoogleCodeExporter commented 9 years ago
This patch resolves the test failures. My best guess is that simplejson's 
changes at
2.0.0 are to "blame" here. I tested on Fedora Rawhide x86_64, simplejson 2.0.3, 
and
simplejson 2.0.1 just for good measure, both needed this patch.

Original comment by spo...@gmail.com on 20 Oct 2008 at 7:20

Attachments:

GoogleCodeExporter commented 9 years ago
Hmm.  Unfortunately that breaks on non 2.0 versions of simplejson.  Should we be
bundling simplejson with twitter-python just to make sure there isn't a 
mismatch?

Original comment by dclinton on 20 Oct 2008 at 7:25

GoogleCodeExporter commented 9 years ago
Where and how do I install the patch?

Original comment by philipp....@googlemail.com on 26 Oct 2008 at 8:41

GoogleCodeExporter commented 9 years ago
I think there are ways to enforce a version of a module, but I've never done it 
myself. I'm all for bundling, unless 
there are some critical problems fixed since this change. The change happened 
in 1.8, by the way, not 2.0.

Original comment by dan.y.t...@gmail.com on 13 Nov 2008 at 10:49

GoogleCodeExporter commented 9 years ago
The alternative could be to modify the simplejson stuff from the twitter module 
if simplejson's __version__ is 1.8 
or up. Kind of hackish and you have to disable the C encoder, but it prevents 
the need to bundle simplejson. 
Example patch included.

Original comment by dan.y.t...@gmail.com on 14 Nov 2008 at 5:44

Attachments:

GoogleCodeExporter commented 9 years ago
Hey guys, I am relatively new to Python and I'm unsure about how to install 
either of
patches that have been made available for this fix.  Would someone mind posting
instructions on how to install them or point me in the right direction?  I'd 
really
appreciate the help, thanks.

Original comment by kunal.d....@gmail.com on 1 Dec 2008 at 8:09

GoogleCodeExporter commented 9 years ago
If you're on a Unix system, download the file to the directory containing 
twitter.py 
and type "patch < xxx.patch" in a terminal, where xxx is replaced by the name 
of the 
patch you want to apply. I've never done it in Windows before, so I don't know 
how 
people normally do it. Alternatively, you can just replace your twitter.py with 
the 
attached file. The only difference is the first if statement after the imports.

Original comment by dan.y.t...@gmail.com on 1 Dec 2008 at 8:17

Attachments:

GoogleCodeExporter commented 9 years ago
Hey Dan, thanks for posting that file.  I am on a Windows machine, and when I
replaced my twitter.py file, reinstalled, and tested again, my JSON errors were 
gone
but I got 3 new errors relating to the Status class - 

FAIL: Test all of the twitter.Status getters and setters
FAIL: Test all of the twitter.Status properties
FAIL: Test various permutations of Status relative_created_at

Not quite sure why these are occurring, any help you could provide would be
appreciated.  Thanks.

Original comment by kunal.d....@gmail.com on 1 Dec 2008 at 8:27

GoogleCodeExporter commented 9 years ago
Ah, I was working on the development version of the library. Try this test file 
with 
it.

Original comment by dan.y.t...@gmail.com on 1 Dec 2008 at 8:46

Attachments:

GoogleCodeExporter commented 9 years ago
Great, that worked, thanks for the help with this issue!

Original comment by kunal.d....@gmail.com on 1 Dec 2008 at 8:51

GoogleCodeExporter commented 9 years ago
Fixed in trunk. Please verify.

Original comment by dclinton on 21 Jan 2009 at 7:55