Skip to content

Commit 6785d6d

Browse files
committed
Update libbson to 1.6.2
1 parent aa3845b commit 6785d6d

File tree

6 files changed

+44
-37
lines changed

6 files changed

+44
-37
lines changed

libbson

Submodule libbson updated 583 files

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
except Exception:
3535
description = ""
3636

37-
tests_require = ["pymongo"]
37+
tests_require = ["pymongo>=3.4.0"]
3838
if sys.version_info[:2] == (2, 6):
3939
tests_require.append("unittest2 >= 0.5.1")
4040
test_suite = "unittest2.collector"
@@ -75,7 +75,7 @@
7575
include_dirs=["src",
7676
"src/bson",
7777
"libbson/src",
78-
"libbson/src/yajl",
78+
"libbson/src/jsonsl",
7979
"libbson/src/bson"],
8080
define_macros=[("BSON_COMPILATION", 1)],
8181
libraries=["ws2_32"] if sys.platform == "win32" else []

src/bson/bson-config.h

-9
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,4 @@
157157
# undef BSON_HAVE_DECIMAL128
158158
#endif
159159

160-
161-
/*
162-
* Define to 1 to support experimental future BSON or MongoDB features.
163-
*/
164-
#define BSON_EXPERIMENTAL_FEATURES 1
165-
#if BSON_EXPERIMENTAL_FEATURES != 1
166-
# undef BSON_EXPERIMENTAL_FEATURES
167-
#endif
168-
169160
#endif /* BSON_CONFIG_H */

src/bson/bson-version.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@
3737
*
3838
* BSON minor version component (e.g. 2 if %BSON_VERSION is 1.2.3)
3939
*/
40-
#define BSON_MINOR_VERSION (4)
40+
#define BSON_MINOR_VERSION (6)
4141

4242

4343
/**
4444
* BSON_MICRO_VERSION:
4545
*
4646
* BSON micro version component (e.g. 3 if %BSON_VERSION is 1.2.3)
4747
*/
48-
#define BSON_MICRO_VERSION (0)
48+
#define BSON_MICRO_VERSION (2)
4949

5050

5151
/**
@@ -60,7 +60,7 @@
6060
*
6161
* BSON version.
6262
*/
63-
#define BSON_VERSION (1.4.0)
63+
#define BSON_VERSION (1.6.2)
6464

6565

6666
/**
@@ -69,7 +69,7 @@
6969
* BSON version, encoded as a string, useful for printing and
7070
* concatenation.
7171
*/
72-
#define BSON_VERSION_S "1.4.0"
72+
#define BSON_VERSION_S "1.6.2"
7373

7474

7575
/**

test/__init__.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2017 MongoDB, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
import sys
15+
16+
if sys.version_info[0] == 2:
17+
from StringIO import StringIO
18+
else:
19+
from io import StringIO
20+
21+
if sys.version_info[:2] == (2, 6):
22+
import unittest2 as unittest
23+
else:
24+
import unittest

test/test_bsonjs.py

+13-21
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,6 @@
1919
import sys
2020
import uuid
2121

22-
sys.path.insert(0, "")
23-
24-
if sys.version_info[0] == 2:
25-
from StringIO import StringIO
26-
else:
27-
from io import StringIO
28-
29-
if sys.version_info[:2] == (2, 6):
30-
import unittest2 as unittest
31-
else:
32-
import unittest
33-
3422
import bson
3523
from bson import json_util, EPOCH_AWARE
3624
from bson.binary import Binary, MD5_SUBTYPE, USER_DEFINED_SUBTYPE
@@ -46,8 +34,12 @@
4634
from bson.timestamp import Timestamp
4735
from bson.tz_util import utc
4836

37+
sys.path.insert(0, "")
38+
4939
import bsonjs
5040

41+
from test import StringIO, unittest
42+
5143

5244
def to_object(bson_bytes):
5345
"""Return deserialized object from BSON bytes"""
@@ -80,8 +72,11 @@ def round_trip(self, doc):
8072
bson_bytes = to_bson(doc)
8173
self.assertEqual(bson_bytes, bsonjs.loads(bsonjs.dumps(bson_bytes)))
8274
# Check compatibility between bsonjs and json_util
83-
self.assertEqual(doc, json_util.loads(bsonjs.dumps(bson_bytes)))
84-
self.assertEqual(bson_bytes, bsonjs.loads(json_util.dumps(doc)))
75+
self.assertEqual(doc, json_util.loads(
76+
bsonjs.dumps(bson_bytes),
77+
json_options=json_util.STRICT_JSON_OPTIONS))
78+
self.assertEqual(bson_bytes, bsonjs.loads(json_util.dumps(
79+
doc, json_options=json_util.STRICT_JSON_OPTIONS)))
8580

8681
def test_basic(self):
8782
self.round_trip({"hello": "world"})
@@ -173,7 +168,6 @@ def test_timestamp(self):
173168
rtdct = bsonjs_loads(res)
174169
self.assertEqual(dct, rtdct)
175170

176-
@unittest.skip("PYTHON-1103")
177171
def test_uuid(self):
178172
self.round_trip({"uuid":
179173
uuid.UUID("f47ac10b-58cc-4372-a567-0e02b2c3d479")})
@@ -203,15 +197,15 @@ def test_binary(self):
203197
self.assertRaises(ValueError, bsonjs.loads,
204198
'{"a": {"$binary": "invalid", "$type": "80"}}')
205199

206-
@unittest.skip("CDRIVER-1335")
207200
def test_code(self):
208201
self.round_trip({"code": Code("function x() { return 1; }")})
209202
code = {"code": Code("return z", z=2)}
210203
self.round_trip(code)
211204

212205
# Check order.
213-
self.assertEqual('{"$code": "return z", "$scope": {"z": 2}}',
214-
bsonjs_dumps(code))
206+
self.assertEqual(
207+
'{ "code" : { "$code" : "return z", "$scope" : { "z" : 2 } } }',
208+
bsonjs_dumps(code))
215209

216210
def test_undefined(self):
217211
json_str = '{"name": {"$undefined": true}}'
@@ -229,14 +223,12 @@ def test_numberlong(self):
229223
self.assertRaises(ValueError, bsonjs.loads,
230224
'{"a": {"$numberLong": "not-a-number"}}')
231225

232-
@unittest.skip("CDRIVER-1366")
233226
def test_load_mongodb_extended_type_at_top_level(self):
234227
self.assertRaises(ValueError, bsonjs.loads,
235228
'{"$numberLong": "42"}')
236229
self.assertRaises(ValueError, bsonjs.loads,
237230
'{"$numberLong": "42", "a": 1}')
238-
self.assertRaises(ValueError, bsonjs.loads,
239-
'{"a": 1, "$numberLong": "42"}')
231+
_ = bsonjs.loads('{"a": 1, "$numberLong": "42"}')
240232

241233
def test_dumps_multiple_bson_documents(self):
242234
json_str = '{ "test" : "me" }'

0 commit comments

Comments
 (0)