summaryrefslogtreecommitdiff
path: root/archaeological_finds/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/tests.py')
-rw-r--r--archaeological_finds/tests.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py
index 60dcb5a5d..346aa0b1e 100644
--- a/archaeological_finds/tests.py
+++ b/archaeological_finds/tests.py
@@ -1591,6 +1591,35 @@ class FindSearchTest(FindInit, TestCase, SearchText):
result = [('-{}="{}"'.format(key, "*"), models.Find.objects.count() - 1)]
self._test_search(c, result, context="-* description Search")
+ def test_number_search(self):
+ # test year search with "=>" notation
+ ope1 = self.operations[0]
+ ope1.year = 2000
+ ope1.save()
+ ope2 = self.operations[1]
+ ope2.year = 2020
+ ope2.save()
+ self.create_finds()
+ self.create_finds()
+
+ c = Client()
+ c.login(username=self.username, password=self.password)
+
+ key = str(pgettext_lazy("key for text search", "year"))
+
+ result = [('{}="{}"'.format(key, 2000), 3)]
+ self._test_search(c, result, context="Exact year search")
+ result = [('{}="{}"'.format(key, 2020), 1)]
+ self._test_search(c, result, context="Exact year search")
+ result = [('{}=>"{}"'.format(key, 2019), 1)]
+ self._test_search(c, result, context="=> year search")
+ result = [('{}=>"{}"'.format(key, 1999), 4)]
+ self._test_search(c, result, context="=> year search")
+ result = [('{}=<"{}"'.format(key, 2001), 3)]
+ self._test_search(c, result, context="=< year search")
+ result = [('{}=>"{}" {}=<"{}"'.format(key, 2001, key, 2022), 1)]
+ self._test_search(c, result, context="=> and =< year search")
+
def test_address_operation_search(self):
operation = self.operations[0]
operation.address = "Street somewhere 29478 NOWHERE"