Skip to content

Commit 3649fc5

Browse files
committed
Simplify numpy usage
1 parent e2fa2a5 commit 3649fc5

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

integration/test_collection.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import uuid
77
from typing import Any, Callable, Dict, List, Optional, Sequence, TypedDict, Union
88

9+
import numpy as np
910
import pytest
1011

1112
from integration.conftest import CollectionFactory, CollectionFactoryGet, _sanitize_collection_name
@@ -61,15 +62,6 @@
6162
DATE3 = datetime.datetime.strptime("2019-06-10", "%Y-%m-%d").replace(tzinfo=datetime.timezone.utc)
6263

6364

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-
7365
def test_insert_with_typed_dict_generic(
7466
collection_factory: CollectionFactory,
7567
collection_factory_get: CollectionFactoryGet,
@@ -309,18 +301,18 @@ class TestInsertManyWithTypedDict(TypedDict):
309301
(
310302
[
311303
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])
313305
),
314306
],
315307
False,
316308
),
317309
(
318310
[
319311
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])
321313
),
322314
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])
324316
),
325317
],
326318
False,
@@ -329,7 +321,7 @@ class TestInsertManyWithTypedDict(TypedDict):
329321
[
330322
DataObject(
331323
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]]),
333325
),
334326
],
335327
True,

0 commit comments

Comments
 (0)