|
43 | 43 | "bar",
|
44 | 44 | 1,
|
45 | 45 | 1,
|
| 46 | + "WHEREIN", |
| 47 | + "foo", |
| 48 | + 1, |
| 49 | + 1, |
| 50 | + "WHEREIN", |
| 51 | + "bar", |
| 52 | + 1, |
| 53 | + 1, |
46 | 54 | "FENCE",
|
47 | 55 | "DETECT",
|
48 | 56 | "enter,exit",
|
@@ -70,6 +78,8 @@ async def test_command_nearby_compile(tile38, format, precision, expected):
|
70 | 78 | .limit(10)
|
71 | 79 | .where("foo", 1, 1)
|
72 | 80 | .where("bar", 1, 1)
|
| 81 | + .wherein("foo", 1, [1]) |
| 82 | + .wherein("bar", 1, [1]) |
73 | 83 | .fence()
|
74 | 84 | .detect(["enter", "exit"])
|
75 | 85 | .commands(["del", "set"])
|
@@ -127,6 +137,42 @@ async def test_command_nearby_where_point(tile38):
|
127 | 137 | assert len(response.objects) == 2
|
128 | 138 |
|
129 | 139 |
|
| 140 | +@pytest.mark.asyncio |
| 141 | +async def test_command_nearby_wherein_point(tile38): |
| 142 | + await ( |
| 143 | + tile38.set(key, id) |
| 144 | + .fields({"maxspeed": 120, "maxweight": 1000}) |
| 145 | + .object(feature) |
| 146 | + .exec() |
| 147 | + ) |
| 148 | + await ( |
| 149 | + tile38.set(key, "truck1") |
| 150 | + .fields({"maxspeed": 100, "maxweight": 1000}) |
| 151 | + .object(feature) |
| 152 | + .exec() |
| 153 | + ) |
| 154 | + |
| 155 | + response = ( |
| 156 | + await tile38.nearby(key) |
| 157 | + .wherein("maxspeed", 1, [120]) |
| 158 | + .point(52.250212, 13.370871) |
| 159 | + .asObjects() |
| 160 | + ) |
| 161 | + assert response.ok |
| 162 | + assert len(response.objects) == 1 |
| 163 | + assert response.objects[0].dict() == dict(expected, **{"fields": [120, 1000]}) |
| 164 | + |
| 165 | + response = ( |
| 166 | + await tile38.nearby(key) |
| 167 | + .wherein("maxspeed", 2, [100, 120]) |
| 168 | + .wherein("maxweight", 1, [1000]) |
| 169 | + .point(52.250212, 13.370871) |
| 170 | + .asObjects() |
| 171 | + ) |
| 172 | + assert response.ok |
| 173 | + assert len(response.objects) == 2 |
| 174 | + |
| 175 | + |
130 | 176 | @pytest.mark.asyncio
|
131 | 177 | async def test_command_nearby_point_with_radius(tile38):
|
132 | 178 | response = await tile38.set(key, id).object(feature).exec()
|
|
0 commit comments