diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2020-02-09 17:43:29 +0100 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2020-02-09 17:43:29 +0100 |
commit | a96b3e1f7acac3cc7bd0ae74be411e97fc27912c (patch) | |
tree | b3fe9871463c4b74eb456260bbe415ef06efafec /tests | |
parent | 00148a2b195b2ca35054346825efabac81629332 (diff) |
Simple fixes to improve test coverage
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/simple/items/085682ed-6792-499d-a3ab-9aebd683c011.yaml | 3 | ||||
-rw-r--r-- | tests/data/simple/items/8b69b063b2a64db7b5714294a69255c7.yaml | 2 | ||||
-rw-r--r-- | tests/data/simple/settings.yaml | 10 | ||||
-rw-r--r-- | tests/data/wrong/items/b9a832309c984ada9f267471660c1313.yaml | 2 | ||||
-rw-r--r-- | tests/data/wrong/settings.yaml | 6 | ||||
-rw-r--r-- | tests/test_collection.py | 8 |
6 files changed, 26 insertions, 5 deletions
diff --git a/tests/data/simple/items/085682ed-6792-499d-a3ab-9aebd683c011.yaml b/tests/data/simple/items/085682ed-6792-499d-a3ab-9aebd683c011.yaml index 0abc78d..99431b1 100644 --- a/tests/data/simple/items/085682ed-6792-499d-a3ab-9aebd683c011.yaml +++ b/tests/data/simple/items/085682ed-6792-499d-a3ab-9aebd683c011.yaml @@ -3,4 +3,7 @@ description: | This is a long block of text that spans multiple lines. position: somewhere +quantity: 2 +value: 0.8 +cost: 1.99 eid: 085682ed6792499da3ab9aebd683c011 diff --git a/tests/data/simple/items/8b69b063b2a64db7b5714294a69255c7.yaml b/tests/data/simple/items/8b69b063b2a64db7b5714294a69255c7.yaml index 7a0f5d7..d64a7c2 100644 --- a/tests/data/simple/items/8b69b063b2a64db7b5714294a69255c7.yaml +++ b/tests/data/simple/items/8b69b063b2a64db7b5714294a69255c7.yaml @@ -2,4 +2,6 @@ name: 'Mostly empty entry' description: position: quantity: +amount: +price: other: diff --git a/tests/data/simple/settings.yaml b/tests/data/simple/settings.yaml index ad68fe3..1852665 100644 --- a/tests/data/simple/settings.yaml +++ b/tests/data/simple/settings.yaml @@ -9,11 +9,19 @@ fields: index: free - name: position type: string - index: facet + index: field - name: quantity type: integer index: no help: 'how many items are there' + - name: value + type: float + index: no + help: 'how much each item is' + - name: cost + type: decimal + index: no + help: 'how much this costs' - name: other type: yaml help: '' diff --git a/tests/data/wrong/items/b9a832309c984ada9f267471660c1313.yaml b/tests/data/wrong/items/b9a832309c984ada9f267471660c1313.yaml index ec44b7c..b36cc4e 100644 --- a/tests/data/wrong/items/b9a832309c984ada9f267471660c1313.yaml +++ b/tests/data/wrong/items/b9a832309c984ada9f267471660c1313.yaml @@ -3,3 +3,5 @@ description: | . position: 'somewhere' number: 'four' +float: 'half and a bit' +price: 'cheap' diff --git a/tests/data/wrong/settings.yaml b/tests/data/wrong/settings.yaml index ef9ab74..243ab62 100644 --- a/tests/data/wrong/settings.yaml +++ b/tests/data/wrong/settings.yaml @@ -12,3 +12,9 @@ fields: - name: number type: integer help: "Enter an integer here" + - name: float + type: float + help: "Enter a floating point number here" + - name: price + type: decimal + help: 'prices are never float!' diff --git a/tests/test_collection.py b/tests/test_collection.py index b5266d9..798e561 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -28,8 +28,8 @@ class testCollection(unittest.TestCase): self.collection.settings['name'], "Simple lesana collection" ) - self.assertEqual(len(self.collection.settings['fields']), 5) - self.assertEqual(len(self.collection.indexed_fields), 2) + self.assertEqual(len(self.collection.settings['fields']), 7) + self.assertEqual(len(self.collection.indexed_fields), 3) self.collection.update_cache() self.assertIsNotNone(self.collection.stemmer) @@ -54,7 +54,7 @@ class testCollection(unittest.TestCase): self.assertIsNotNone(self.collection.settings) self.assertIsNotNone(self.collection.stemmer) # Fields with no "index" entry are not indexed - self.assertEqual(len(self.collection.settings['fields']), 4) + self.assertEqual(len(self.collection.settings['fields']), 6) self.assertEqual(len(self.collection.indexed_fields), 1) def test_load_safe(self): @@ -326,7 +326,7 @@ class testCollectionWithErrors(unittest.TestCase): self.collection.settings['name'], "Lesana collection with certain errors" ) - self.assertEqual(len(self.collection.settings['fields']), 4) + self.assertEqual(len(self.collection.settings['fields']), 6) self.assertIsNotNone(self.collection.stemmer) self.assertEqual(len(self.collection.indexed_fields), 1) |