hide to_dicts as _to_dicts
This commit is contained in:
parent
49b1ecd591
commit
1b535bbbb2
@ -382,7 +382,7 @@ def is_valid(bson):
|
||||
except (AssertionError, InvalidBSON):
|
||||
return False
|
||||
|
||||
def to_dicts(data):
|
||||
def _to_dicts(data):
|
||||
"""Convert binary data to sequence of SON objects.
|
||||
|
||||
Data must be concatenated strings of valid BSON data.
|
||||
|
||||
@ -270,7 +270,7 @@ class Cursor(object):
|
||||
|
||||
number_returned = struct.unpack("<i", response[16:20])[0]
|
||||
self.__retrieved += number_returned
|
||||
self.__data = bson.to_dicts(response[20:])
|
||||
self.__data = bson._to_dicts(response[20:])
|
||||
assert len(self.__data) == number_returned
|
||||
|
||||
if self.__id is None:
|
||||
|
||||
@ -29,7 +29,7 @@ from pymongo.code import Code
|
||||
from pymongo.objectid import ObjectId
|
||||
from pymongo.dbref import DBRef
|
||||
from pymongo.son import SON
|
||||
from pymongo.bson import BSON, is_valid, to_dicts
|
||||
from pymongo.bson import BSON, is_valid, _to_dicts
|
||||
from pymongo.errors import UnsupportedTag
|
||||
|
||||
class TestBSON(unittest.TestCase):
|
||||
@ -58,7 +58,7 @@ class TestBSON(unittest.TestCase):
|
||||
self.assertEqual({"test": u"hello world"},
|
||||
BSON("\x1B\x00\x00\x00\x0E\x74\x65\x73\x74\x00\x0C\x00\x00\x00\x68\x65\x6C\x6C\x6F\x20\x77\x6F\x72\x6C\x64\x00\x00").to_dict())
|
||||
self.assertEqual([{"test": u"hello world"}, {}],
|
||||
to_dicts("\x1B\x00\x00\x00\x0E\x74\x65\x73\x74\x00\x0C\x00\x00\x00\x68\x65\x6C\x6C\x6F\x20\x77\x6F\x72\x6C\x64\x00\x00\x05\x00\x00\x00\x00"))
|
||||
_to_dicts("\x1B\x00\x00\x00\x0E\x74\x65\x73\x74\x00\x0C\x00\x00\x00\x68\x65\x6C\x6C\x6F\x20\x77\x6F\x72\x6C\x64\x00\x00\x05\x00\x00\x00\x00"))
|
||||
|
||||
def test_basic_from_dict(self):
|
||||
self.assertRaises(TypeError, BSON.from_dict, 100)
|
||||
|
||||
@ -59,7 +59,7 @@ def main():
|
||||
print "enc json",
|
||||
enc_json = run(case, json.dumps)
|
||||
print "dec bson",
|
||||
assert case == run(enc_bson, bson.to_dicts)[0]
|
||||
assert case == run(enc_bson, bson._to_dicts)[0]
|
||||
print "dec json",
|
||||
assert case == run(enc_json, json.loads)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user