Commit Graph

61 Commits

Author SHA1 Message Date
Bernie Hackett
521f7b9af4 PYTHON-2133 Fix up docs
And finish deleting python 2 specific code.
2021-01-21 15:49:23 -08:00
Bernie Hackett
e17299ab2e PYTHON-2133 Remove u prefixes from code 2021-01-20 16:10:23 -08:00
Bernie Hackett
a72e8b8823 PYTHON-2133 Remove py2 support from test
Also delete bson/py3compat.py
2021-01-20 09:40:36 -08:00
Prashant Mital
4760d07815
PYTHON-2152 Expand native UUID handling support; Implement UUID specification 2020-06-01 17:45:08 -07:00
Prashant Mital
ef3df1663c
PYTHON-1918 Stop using BSON.encode and BSON.decode functions 2019-09-09 18:06:46 -07:00
Bernie Hackett
e92e2b0efb PYTHON-1648 Binary buffer protocol support 2019-07-18 08:41:40 -07:00
Bernie Hackett
e6b0f3847d PYTHON-1581 - Deprecate Collection/Cursor count 2018-06-18 10:50:26 -07:00
Bernie Hackett
507f954ed4 Update copyright dates 2017-12-01 17:23:39 -08:00
Shane Harvey
e775295ab5 PYTHON-1367 Ignore uuid_representation when decoding BSON binary subtype 4. 2017-09-12 17:20:14 -07:00
Bernie Hackett
53a7bea492 PYTHON-1022 - Drop support for Python 3.2
This change removes the u() helper from bson.py3compat
and all of its uses in the driver and tests. PyPy3 continues
to be supported since, even though it is based on python 3.2.5,
it has always supported the u string prefix.

The README and install docs are now explicit about PyPy(3) support.
2016-06-15 10:05:43 -07:00
Bernie Hackett
a331fa9ff2 PYTHON-977 - Don't use b() on master 2015-09-04 18:38:14 -07:00
Luke Lovett
d5d1d03a3d PYTHON-977 - avoid 'b' string prefix for Python version compatibility in tests. 2015-09-04 16:04:52 -07:00
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
Bernie Hackett
30af616009 PYTHON-821 - Migrate most tests to new the CRUD API. 2015-02-13 08:46:43 -08:00
A. Jesse Jiryu Davis
9da835ab3d PYTHON-825 BSON API changes and internal options handling.
This change resolves four issues:

PYTHON-826 The new codec_options submodule is moved from pymongo to bson.

PYTHON-827 Use codec_options in BSON APIs.

Functions and methods of the bson module that accepted the options as_class,
tz_aware, and uuid_subtype now accept a codec_options parameter instead.

For example, the function definition for bson.decode_all changes from this:

def decode_all(data, as_class=dict, tz_aware=True,
               uuid_subtype=OLD_UUID_SUBTYPE)

to:

def decode_all(data, codec_options=CodecOptions())

The following functions are changed:

- decode_all
- decode_iter
- decode_file_iter

The following methods are changed:

- BSON.encode
- BSON.decode

This is a breaking change for any application that uses the BSON API directly
and changes any of the named parameter defaults. No changes are required for
applications that use the default values for these options. The behavior
remains the same.

PYTHON-828 Internal BSON module changes to support CodecOptions

The pure Python BSON module passes around a CodecOptions instance instead of
as_class, tz_aware, and uuid_subtype. C extensions pass these values around in
a struct.

PYTHON-801 Rename uuid_subtype to uuid_representation.
2015-02-05 23:09:23 -06:00
A. Jesse Jiryu Davis
a2c13090d8 PYTHON-826 Move codec_options submodule from pymongo to bson. 2015-02-02 09:38:49 -05:00
Bernie Hackett
a3fb2462bb PYTHON-801 - Remove BaseObject.uuid_subtype 2014-12-29 07:34:07 -08:00
A. Jesse Jiryu Davis
2f9d24ade6 PYTHON-525 Reimplement MongoClient to use Cluster.
Replace MongoClient with an implementation that relies on Cluster and Server. The new MongoClient takes over MongoReplicaSetClient's responsibilities.

Authentication, secondary-pinning, and Mongos high-availability are broken and will be reimplemented in a future commit. RS tests are temporarily disabled.
2014-08-28 16:57:57 -04:00
A. Jesse Jiryu Davis
118b47e6e3 Unused imports. 2014-07-17 15:23:40 -04:00
Luke Lovett
4fa96c6c2e PYTHON-683 Separate unit tests and integration tests in the pymongo test suite.
Raise SkipTest in tests that require a connection to MongoDB when none is available.
2014-06-30 17:42:29 +00:00
Luke Lovett
26fb43cf78 PYTHON-681 Reuse MongoClient whenever possible in the tests 2014-05-21 20:41:18 +00:00
Luke Lovett
141200083e PYTHON-680 Stop using nose in favor of pure unittest/unittest2 2014-04-25 22:57:33 +00:00
Bernie Hackett
b26459cd6a Remove useless uuid module checks.
These were only needed for python 2.4 which does
not provide a uuid module.
2014-04-24 10:09:21 -07:00
Bernie Hackett
91d6b5b5d4 PYTHON-676 - Use bytes instead of binary_type 2014-04-23 13:24:16 -07:00
Luke Lovett
4d6d1e067b PYTHON-676 python 2/3 single-source for the test module 2014-04-23 18:37:02 +00:00
A. Jesse Jiryu Davis
2fa1750b07 Update copyright notices and company name. 2014-01-31 09:36:46 -05:00
hawka
74546ec88d Adding Support for readPreferenceTags and uuidRepresentation in URI parsing. PYTHON-473 2013-08-30 15:38:34 -04: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
A. Jesse Jiryu Davis
c758efcb34 Rename test_connection -> test_client, test_replica_set_connection -> test_replica_set_client PYTHON-451 2013-02-11 21:33:55 -05:00
A. Jesse Jiryu Davis
d35bec12e5 Tests use MongoClient instead of Connection PYTHON-451 2013-02-11 20:57:17 -05:00
Ross Lawley
29b9de45db Added __ne__ for DBRefs PYTHON-440 2012-11-22 11:12:36 +00:00
Bernie Hackett
f812d1babb Support copy of UUIDLegacy 2012-11-19 06:27:59 -08:00
Bernie Hackett
ae3a534dfb Fix pickling of Binary with Python 3.1 PYTHON-422
This works around http://bugs.python.org/issue7382
2012-10-25 09:43:14 -07:00
Ross Lawley
996a57c1b0 Ensure test starts cleanly 2012-10-03 07:44:12 +00:00
A. Jesse Jiryu Davis
461e2529f7 Informative message whenever skipping a test 2012-08-21 23:24:47 -04:00
behackett
638bb7fbdc Support Java and C# UUID byte order PYTHON-387 2012-08-15 12:10:26 -07:00
behackett
0ee7170cc2 It's 2012... 2012-04-19 12:40:38 -07:00
behackett
12592be1fe Python 3 unittest changes PYTHON-84. 2012-03-28 11:53:47 -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
behackett
eb5959ee95 Default to Binary subtype 3 for UUIDs PYTHON-267 2011-12-06 11:58:43 -08:00
behackett
8bdb7821a9 Always decode to UUID PYTHON-267 2011-09-14 15:11:58 -07:00
behackett
258f81870e Store UUIDs as BSON binary subtype 4 PYTHON-267
The default binary subtype for UUIDs has changed
to 4. You can use bson.binary.UUIDLegacy to query
on UUIDs previously stored as subtype 3. See the
UUIDLegacy docstring for more details.
2011-09-14 13:12:36 -07:00
behackett
3603d05ce1 Switch default Binary subtype from 2 to 0. 2011-08-01 15:33:24 -07:00
Mike Dirolf
9c182809f3 Create a separate bson package PYTHON-60
Many of the pymongo modules have been moved into the bson
package. Aliases for those modules have been added to the pymongo
package, without deprecation warnings for now. Application developers
should begin to use the bson namespace, as deprecation of moved
modules will probably begin in the next release.
2010-09-14 13:52:50 -04:00
jbergstroem
ec22172030 s/failIf/assertFalse 2010-08-11 03:44:06 +08:00
Mike Dirolf
790f87be4a actually, keep using subtype 2 as default for a while 2010-06-17 11:37:19 -04:00
Mike Dirolf
ce965158d6 use subtype 0 as default for Binary, instead of 2 2010-06-16 12:13:25 -04:00
Mike Dirolf
3d7240e57f It's 2010! 2010-01-30 10:48:26 -05:00
Mike Dirolf
82f84b9f3f Binary instances should never compare equal to str instances 2009-11-10 17:10:50 -05:00