def test_number_lt(self): f = self.api \ .form("everything") \ .ref(self.api.get_master()) \ .query(predicates.lt('my.form-post.publication-date', 4)) self.assertEqual( f.data['q'], ['[[:d = number.lt(my.form-post.publication-date, 4)]]'])
def test_get_number(self): api = prismic.get('https://lesbonneschoses.prismic.io/api') response = api.form('everything').query(predicates.at("document.id", "UlfoxUnM0wkXYXbO"))\ .ref(api.get_master()).submit() doc = response.documents[0] # startgist:2d89caba900bb897e72b:prismic-getNumber.py # Number predicates gt = predicates.gt("my.product.price", 10) lt = predicates.lt("my.product.price", 20) in_range = predicates.in_range("my.product.price", 10, 20) # Accessing number fields price = doc.get_number("product.price").value # endgist self.assertEqual(price, 2.5)
def test_number_lt(self): f = self.api \ .form("everything") \ .ref(self.api.get_master()) \ .query(predicates.lt('my.blog-post.publication-date', 4)) self.assertEqual(f.data['q'], ['[[:d = number.lt(my.blog-post.publication-date, 4)]]'])
def test_number_lt(api): f = api \ .form("everything") \ .ref(api.get_master()) \ .query(predicates.lt('my.form-post.publication-date', 4)) assert f.data['q'] == ['[[:d = number.lt(my.form-post.publication-date, 4)]]']