Commit Graph

19 Commits

Author SHA1 Message Date
Luke Lovett
3321b66d34 PYTHON-977 - Fix __hash__ method on BSON types that inherit from Python builtin types.
In Python 2, objects automatically inherit the __hash__ of their parent
class. In Python 3, objects that override __eq__ do not automatically inherit
__hash__, so these objects were not hashable under Python 3.  Additionally,
mutable BSON types and types that overide __eq__ but did not explicitly define
__hash__ had broken __hash__ methods under Python 2.  This commit unifies the
hashing behavior between Python versions and fixes the __hash__ methods such
that two BSON objects hash the same only if they are equal.

N.B.: bson.code.Code and bson.regex.Regex are no longer hashable under Python 2
because they are mutable.
2015-09-04 14:45:24 -07:00
Bernie Hackett
aec685b374 Fix up copyright dates. 2015-03-25 11:55:02 -07:00
Luke Lovett
141200083e PYTHON-680 Stop using nose in favor of pure unittest/unittest2 2014-04-25 22:57:33 +00:00
A. Jesse Jiryu Davis
2fa1750b07 Update copyright notices and company name. 2014-01-31 09:36:46 -05:00
A. Jesse Jiryu Davis
f1f7b14bf6 Allow MongoClients to be GC'ed after test runs.
Work around http://bugs.python.org/issue11798 to reduce max connection count during tests.
2013-08-27 09:00:50 -04:00
Ross Lawley
29b9de45db Added __ne__ for DBRefs PYTHON-440 2012-11-22 11:12:36 +00:00
behackett
0ee7170cc2 It's 2012... 2012-04-19 12:40:38 -07:00
behackett
2d21ba9376 Replace deprecated unittest assert method aliases.
assert_ -> assertTrue
assertEquals -> assertEqual

This is needed to clean up deprecation warnings
in python >= 3.2
2012-03-16 17:20:21 -07:00
Ross Lawley
486c3ce24a PYTHON-318 - Fix for SON pickling protocol 2
Updated tests to check protocol pickling as well
2012-02-08 14:59:33 -08:00
Ross Lawley
ea6ce59b94 Revert "Ensures UTC stays a singleton"
This reverts commit 088f6b6b57.
2011-12-20 10:48:47 -08:00
Ross Lawley
aadd9e4eb4 Ensures UTC stays a singleton 2011-12-20 10:48:47 -08:00
Ross Lawley
8c68bde1f8 FixedOffset objects can now be copied / pickled
Defined __getinitargs__ so FixedOffset objects can
be copied / pickled.
2011-12-20 10:48:47 -08:00
behackett
2ed05bec70 PEP8 cleanups. 2011-04-06 14:57:17 -07:00
Mike Dirolf
e61ee2b3fd Move json_util from pymongo to bson as well PYTHON-60 2010-09-14 13:55:22 -04:00
Mike Dirolf
58335bb16e fix test 2010-06-29 15:26:23 -04:00
Mike Dirolf
2a37d25827 Use timezone aware datetimes in Timestamp and json_util.
These are the last two places that aren't properly using/handling
timezone_aware datetime instances. This is a BREAKING change,
depending on how an application is using the datetime instances
returned.
2010-06-29 10:30:00 -04:00
Mike Dirolf
ff1f1bff58 allow creating Timestamp instances from datetimes 2010-05-12 16:27:23 -04:00
Mike Dirolf
1db498ab5e minor: doc/naming 2010-03-08 20:55:33 -05:00
Mathias Stearn
6da27b07b1 Add Timestamp class 2010-03-08 20:03:04 -05:00