diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/complex/settings.yaml | 1 | ||||
-rw-r--r-- | tests/test_collection.py | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/data/complex/settings.yaml b/tests/data/complex/settings.yaml index 7aaf47b..671a9b0 100644 --- a/tests/data/complex/settings.yaml +++ b/tests/data/complex/settings.yaml @@ -15,6 +15,7 @@ fields: - name: position type: string index: field + sortable: true - name: something type: yaml - name: tags diff --git a/tests/test_collection.py b/tests/test_collection.py index 2af4cfe..d05415f 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -285,6 +285,15 @@ class testSimpleCollection(unittest.TestCase): with open(fname, 'r') as fp: self.assertEqual(entry.yaml_data, fp.read()) + def test_list_values(self): + values = self.collection.get_field_values('position') + values = list(values) + self.assertEqual(len(values), 2) + self.assertEqual(values, [ + {'value': 'somewhere', 'frequency': 2}, + {'value': None, 'frequency': 1}, + ]) + class testComplexCollection(unittest.TestCase): def setUp(self): @@ -455,6 +464,16 @@ class testComplexCollection(unittest.TestCase): self.assertEqual(entry.data['updated'].year, now.year) self.assertEqual(entry.data['version'], 2) + def test_list_values(self): + values = self.collection.get_field_values('position') + values = list(values) + self.assertEqual(values, [ + {'value': b'Somewhere', 'frequency': 1}, + {'value': b'over there', 'frequency': 1}, + {'value': b'somewhere', 'frequency': 1}, + {'value': b'there', 'frequency': 1}, + ]) + class testCollectionWithErrors(unittest.TestCase): def setUp(self): |