File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 1515"""Test that each file in mypy_fails/ actually fails mypy, and test some
1616sample client code that uses PyMongo typings.
1717"""
18+
1819from __future__ import annotations
1920
2021import os
3738if TYPE_CHECKING :
3839 from typing_extensions import NotRequired , TypedDict
3940
40- from bson import ObjectId
41+ from bson import Binary , ObjectId
42+ from bson .binary import BinaryVector , BinaryVectorDtype
4143
4244 class Movie (TypedDict ):
4345 name : str
@@ -591,5 +593,19 @@ def test_son_document_type(self) -> None:
591593 obj ["a" ] = 1
592594
593595
596+ class TestBSONFromVectorType (unittest .TestCase ):
597+ def test_from_vector_binaryvector (self ):
598+ list_vector = BinaryVector ([127 , 7 ], BinaryVectorDtype .INT8 )
599+ Binary .from_vector (list_vector )
600+
601+ def test_from_vector_list_int (self ):
602+ list_vector = [127 , 7 ]
603+ Binary .from_vector (list_vector , BinaryVectorDtype .INT8 )
604+
605+ def test_from_vector_list_float (self ):
606+ list_vector = [127.0 , 7.0 ]
607+ Binary .from_vector (list_vector , BinaryVectorDtype .INT8 )
608+
609+
594610if __name__ == "__main__" :
595611 unittest .main ()
You can’t perform that action at this time.
0 commit comments