(self)
| 65 | assert doc.field("weight") == 60.5 |
| 66 | |
| 67 | def test_with_numpy_array(self): |
| 68 | import numpy as np |
| 69 | |
| 70 | doc = Doc._from_tuple( |
| 71 | ( |
| 72 | "1", |
| 73 | 0.0, |
| 74 | None, |
| 75 | { |
| 76 | "image": np.array([1, 2, 3]), |
| 77 | "description": np.random.random(512), |
| 78 | "keys": {1: 1.0, 2: 2.0, 3: 3.0}, |
| 79 | }, |
| 80 | ) |
| 81 | ) |
| 82 | assert doc is not None |
| 83 | assert doc.id == "1" |
| 84 | assert doc.vector("image") == [1, 2, 3] |
| 85 | assert doc.vector("keys") == {1: 1.0, 2: 2.0, 3: 3.0} |
| 86 | |
| 87 | def test_init_normalizes_numpy_vectors(self): |
| 88 | import numpy as np |
nothing calls this directly
no test coverage detected