File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ def _fields_list_to_dict(fields, option_name):
235235 if isinstance (fields , collections .Mapping ):
236236 return fields
237237
238- if isinstance (fields , collections .Sequence ):
238+ if isinstance (fields , ( collections .Sequence , collections . Set ) ):
239239 if not all (isinstance (field , string_type ) for field in fields ):
240240 raise TypeError ("%s must be a list of key names, each an "
241241 "instance of %s" % (option_name ,
Original file line number Diff line number Diff line change @@ -1743,6 +1743,16 @@ def test_find_one(self):
17431743
17441744 self .assertTrue ("hello" in db .test .find_one (projection = ["hello" ]))
17451745 self .assertTrue ("hello" not in db .test .find_one (projection = ["foo" ]))
1746+
1747+ self .assertTrue ("hello" in db .test .find_one (projection = ("hello" ,)))
1748+ self .assertTrue ("hello" not in db .test .find_one (projection = ("foo" ,)))
1749+
1750+ self .assertTrue ("hello" in db .test .find_one (projection = set (["hello" ])))
1751+ self .assertTrue ("hello" not in db .test .find_one (projection = set (["foo" ])))
1752+
1753+ self .assertTrue ("hello" in db .test .find_one (projection = frozenset (["hello" ])))
1754+ self .assertTrue ("hello" not in db .test .find_one (projection = frozenset (["foo" ])))
1755+
17461756 self .assertEqual (["_id" ], list (db .test .find_one (projection = [])))
17471757
17481758 self .assertEqual (None , db .test .find_one ({"hello" : "foo" }))
You can’t perform that action at this time.
0 commit comments