6
6
import uuid
7
7
from typing import Any , Callable , Dict , List , Optional , Sequence , TypedDict , Union
8
8
9
+ import numpy as np
9
10
import pytest
10
11
11
12
from integration .conftest import CollectionFactory , CollectionFactoryGet , _sanitize_collection_name
61
62
DATE3 = datetime .datetime .strptime ("2019-06-10" , "%Y-%m-%d" ).replace (tzinfo = datetime .timezone .utc )
62
63
63
64
64
- def get_numpy_vector (input_list : list ) -> Any :
65
- try :
66
- import numpy as np
67
-
68
- return np .array (input_list )
69
- except ModuleNotFoundError :
70
- return input_list
71
-
72
-
73
65
def test_insert_with_typed_dict_generic (
74
66
collection_factory : CollectionFactory ,
75
67
collection_factory_get : CollectionFactoryGet ,
@@ -309,18 +301,18 @@ class TestInsertManyWithTypedDict(TypedDict):
309
301
(
310
302
[
311
303
DataObject (
312
- properties = {"name" : "some numpy one" }, vector = get_numpy_vector ([1 , 2 , 3 ])
304
+ properties = {"name" : "some numpy one" }, vector = np . array ([1 , 2 , 3 ])
313
305
),
314
306
],
315
307
False ,
316
308
),
317
309
(
318
310
[
319
311
DataObject (
320
- properties = {"name" : "some numpy one" }, vector = get_numpy_vector ([1 , 2 , 3 ])
312
+ properties = {"name" : "some numpy one" }, vector = np . array ([1 , 2 , 3 ])
321
313
),
322
314
DataObject (
323
- properties = {"name" : "some numpy two" }, vector = get_numpy_vector ([11 , 12 , 13 ])
315
+ properties = {"name" : "some numpy two" }, vector = np . array ([11 , 12 , 13 ])
324
316
),
325
317
],
326
318
False ,
@@ -329,7 +321,7 @@ class TestInsertManyWithTypedDict(TypedDict):
329
321
[
330
322
DataObject (
331
323
properties = {"name" : "some numpy 2d" },
332
- vector = get_numpy_vector ([[1 , 2 , 3 ], [11 , 12 , 13 ]]),
324
+ vector = np . array ([[1 , 2 , 3 ], [11 , 12 , 13 ]]),
333
325
),
334
326
],
335
327
True ,
0 commit comments