Esempio n. 1
0
 def test_geopoint_near(self):
     f = self.api \
         .form("everything") \
         .ref(self.api.get_master()) \
         .query(predicates.near('my.store.coordinates', 40.689757, -74.0451453, 15))
     self.assertEqual(f.data['q'], [
         '[[:d = geopoint.near(my.store.coordinates, 40.689757, -74.0451453, 15)]]'
     ])
Esempio n. 2
0
def test_geopoint():
    data = "{\"id\":\"abcd\",\"type\":\"article\",\"href\":\"\",\"slugs\":[],\"tags\":[],\"data\":{\"article\":{\"location\":{\"type\":\"GeoPoint\",\"value\":{\"latitude\":48.877108,\"longitude\":2.333879}}}}}"
    document = prismic.Document(json.loads(data))
    # "near" predicate for GeoPoint fragments
    near = predicates.near("my.store.location", 48.8768767, 2.3338802, 10)

    # Accessing GeoPoint fragments
    place = document.get_geopoint("article.location")
    coordinates = place and ("%.6f,%.6f" % (place.latitude, place.longitude))
    assert coordinates == "48.877108,2.333879"
Esempio n. 3
0
    def test_geopoint(self):
        data = "{\"id\":\"abcd\",\"type\":\"article\",\"href\":\"\",\"slugs\":[],\"tags\":[],\"data\":{\"article\":{\"location\":{\"type\":\"GeoPoint\",\"value\":{\"latitude\":48.877108,\"longitude\":2.333879}}}}}"
        document = prismic.Document(json.loads(data))
        # "near" predicate for GeoPoint fragments
        near = predicates.near("my.store.location", 48.8768767, 2.3338802, 10)

        # Accessing GeoPoint fragments
        place = document.get_geopoint("article.location")
        coordinates = place and ("%.6f,%.6f" % (place.latitude, place.longitude))
        self.assertEqual(coordinates, "48.877108,2.333879")
Esempio n. 4
0
 def test_geopoint_near(self):
     f = self.api \
         .form("everything") \
         .ref(self.api.get_master()) \
         .query(predicates.near('my.store.coordinates', 40.689757, -74.0451453, 15))
     self.assertEqual(f.data['q'], ['[[:d = geopoint.near(my.store.coordinates, 40.689757, -74.0451453, 15)]]'])
Esempio n. 5
0
def test_geopoint_near(api):
    f = api \
        .form("everything") \
        .ref(api.get_master()) \
        .query(predicates.near('my.store.coordinates', 40.689757, -74.0451453, 15))
    assert f.data['q'] == ['[[:d = geopoint.near(my.store.coordinates, 40.689757, -74.0451453, 15)]]']