From 78b9390b2a91235c235eabd1e5dbc002fa28fb93 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Mon, 8 Feb 2021 10:39:20 +0100 Subject: More tests for empty data --- tests/data/complex/items/5084bc6e94f24dc6976629282ef30419.yaml | 2 ++ tests/data/complex/items/8e9fa1ed3c1b4a30a6be7a98eda0cfa7.yaml | 2 ++ tests/data/complex/settings.yaml | 4 ++++ tests/test_collection.py | 6 +++++- 4 files changed, 13 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/data/complex/items/5084bc6e94f24dc6976629282ef30419.yaml b/tests/data/complex/items/5084bc6e94f24dc6976629282ef30419.yaml index 6abdd6d..d4cdaba 100644 --- a/tests/data/complex/items/5084bc6e94f24dc6976629282ef30419.yaml +++ b/tests/data/complex/items/5084bc6e94f24dc6976629282ef30419.yaml @@ -13,4 +13,6 @@ exists: true with_default: default value amount: 1 order: delta +created: +epoch: # and a comment at the end diff --git a/tests/data/complex/items/8e9fa1ed3c1b4a30a6be7a98eda0cfa7.yaml b/tests/data/complex/items/8e9fa1ed3c1b4a30a6be7a98eda0cfa7.yaml index da82d8d..ab9dc70 100644 --- a/tests/data/complex/items/8e9fa1ed3c1b4a30a6be7a98eda0cfa7.yaml +++ b/tests/data/complex/items/8e9fa1ed3c1b4a30a6be7a98eda0cfa7.yaml @@ -11,3 +11,5 @@ exists: with_default: 'default value' amount: 0 order: +created: +epoch: diff --git a/tests/data/complex/settings.yaml b/tests/data/complex/settings.yaml index 1fd36b5..0bdcabb 100644 --- a/tests/data/complex/settings.yaml +++ b/tests/data/complex/settings.yaml @@ -39,3 +39,7 @@ fields: type: string index: field sortable: true + - name: created + type: datetime + - name: epoch + type: datetime diff --git a/tests/test_collection.py b/tests/test_collection.py index 1e37589..9f83655 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -289,7 +289,7 @@ class testComplexCollection(unittest.TestCase): self.collection.settings['name'], "Fully featured lesana collection", ) - self.assertEqual(len(self.collection.settings['fields']), 10) + self.assertEqual(len(self.collection.settings['fields']), 12) self.assertIsNotNone(self.collection.stemmer) self.assertEqual(len(self.collection.indexed_fields), 8) @@ -317,6 +317,10 @@ class testComplexCollection(unittest.TestCase): self.assertIn("name: ''", entry.yaml_data) self.assertIn('with_default', entry.yaml_data) self.assertIn('amount: 0', entry.yaml_data) + self.assertIn("tags: []", entry.yaml_data) + self.assertIn("exists:\n", entry.yaml_data) + self.assertIn("created:\n", entry.yaml_data) + self.assertIn("epoch:\n", entry.yaml_data) def test_load_field_loaders(self): # Check that all fields have been loaded, with the right types -- cgit v1.2.3