aboutsummaryrefslogtreecommitdiff
path: root/tests/test_collection.py
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2021-12-23 17:20:11 +0100
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2021-12-23 17:20:11 +0100
commit4023903eac7c1bb76287b20133913a6d786b7c0d (patch)
treebd9806706e50ef6bd9da00615c09907bc390c714 /tests/test_collection.py
parent81d91de68170396e12d75525a96439a280f95aa7 (diff)
New property ``precision`` for ``decimal`` fields.
Diffstat (limited to 'tests/test_collection.py')
-rw-r--r--tests/test_collection.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/test_collection.py b/tests/test_collection.py
index 659671d..de349ed 100644
--- a/tests/test_collection.py
+++ b/tests/test_collection.py
@@ -381,13 +381,13 @@ class testComplexCollection(unittest.TestCase):
self.collection.settings['name'],
"Fully featured lesana collection",
)
- self.assertEqual(len(self.collection.settings['fields']), 15)
+ self.assertEqual(len(self.collection.settings['fields']), 16)
self.assertIsNotNone(self.collection.stemmer)
self.assertEqual(len(self.collection.indexed_fields), 9)
def test_index(self):
indexed = self.collection.update_cache()
- self.assertEqual(indexed, 9)
+ self.assertEqual(indexed, 10)
def test_indexing_list(self):
self.collection.update_cache(['73097121f1874a6ea2f927db7dc4f11e.yaml'])
@@ -504,13 +504,13 @@ class testComplexCollection(unittest.TestCase):
self.collection.start_search('*')
res = self.collection.get_search_results()
matches = list(res)
- self.assertEqual(len(matches), 9)
+ self.assertEqual(len(matches), 10)
for i in range(5):
self.assertEqual(matches[i].data['order'], None)
- self.assertEqual(matches[5].data['order'], 'alpha')
- self.assertEqual(matches[6].data['order'], 'charlie')
- self.assertEqual(matches[7].data['order'], 'delta')
- self.assertEqual(matches[8].data['order'], 'zucchini')
+ self.assertEqual(matches[6].data['order'], 'alpha')
+ self.assertEqual(matches[7].data['order'], 'charlie')
+ self.assertEqual(matches[8].data['order'], 'delta')
+ self.assertEqual(matches[9].data['order'], 'zucchini')
def test_update_entry(self):
eid = '5084bc6e94f24dc6976629282ef30419'
@@ -545,6 +545,11 @@ class testComplexCollection(unittest.TestCase):
{'value': b'there', 'frequency': 1},
])
+ def test_decimal_as_float(self):
+ eid = 'a4265cc5dfa94c3d8030d7df4a0ab747'
+ entry = self.collection.entry_from_eid(eid)
+ self.assertEqual(entry.data['price'], "1.90")
+
class testCollectionWithErrors(unittest.TestCase):
def setUp(self):