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 15
15
"""Test that each file in mypy_fails/ actually fails mypy, and test some
16
16
sample client code that uses PyMongo typings.
17
17
"""
18
+
18
19
from __future__ import annotations
19
20
20
21
import os
37
38
if TYPE_CHECKING :
38
39
from typing_extensions import NotRequired , TypedDict
39
40
40
- from bson import ObjectId
41
+ from bson import Binary , ObjectId
42
+ from bson .binary import BinaryVector , BinaryVectorDtype
41
43
42
44
class Movie (TypedDict ):
43
45
name : str
@@ -591,5 +593,19 @@ def test_son_document_type(self) -> None:
591
593
obj ["a" ] = 1
592
594
593
595
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
+
594
610
if __name__ == "__main__" :
595
611
unittest .main ()
You can’t perform that action at this time.
0 commit comments