Johan Euphrosine <[EMAIL PROTECTED]> writes: > Johan Euphrosine <[EMAIL PROTECTED]> writes: > >> Johan Euphrosine <[EMAIL PROTECTED]> writes: >> >> > Loic Dachary <[EMAIL PROTECTED]> writes: >> > >> > > proppy <[EMAIL PROTECTED]> writes: >> > > >> > > > Did someone on the list experienced the same issues ? >> > > >> > > Nope. That calls for a fixture, I think. >> > >> > >>> import simplejson >> > >>> print simplejson.JSONEncoder.__doc__ >> > >> > Advices the following: >> > To extend this to recognize other objects, subclass and implement a >> > ``.default()`` method with another method that returns a serializable >> > object for ``o`` if possible, otherwise it should call the superclass >> > implementation (to raise ``TypeError``). >> > >> > Subclassing JSONEncoder into packets.py, and implementing default() to >> > return o.__dict__, should do the trick. >> >> Please review the following patch, it corrects the problem for me: >> http://jpoker.aminche.com/poker-table-is-not-json-serializable.patch > > It seems that this patch break the following testcase, so I guess this > is the desired behaviour: > > FAIL: test_infoPackFail (__main__.PokerClientPacketsTestCase) > ---------------------------------------------------------------------- > Traceback (most recent call last): > File "./test-pokerclientpackets.py", line 146, in test_infoPackFail > self.failUnlessRaises(TypeError, type) > AssertionError: TypeError not raised
Indeed. IIRC the intended behaviour is that each and every object is accounted for and handled with care. There are not many objects and making sure each of them is handled in the proper maner should be possible. Cheers, -- +33 1 76 60 72 81 Loic Dachary mailto:[EMAIL PROTECTED] http://dachary.org/loic/gpg.txt sip:[EMAIL PROTECTED] Latitude: 48.86962325498033 Longitude: 2.3623046278953552 _______________________________________________ Pokersource-users mailing list [email protected] https://mail.gna.org/listinfo/pokersource-users
