From 76849e6374f2ebf2a1df2ac142a150f82bf2e472 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Mon, 2 Jan 2017 18:59:29 +0100 Subject: Custom label for entries --- tests/test_collection.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/test_collection.py b/tests/test_collection.py index e732f9c..9e3df7c 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -109,6 +109,20 @@ class testEntries(unittest.TestCase): self.assertIsInstance(written['name'], str) os.remove(entry_fname) + def test_entry_representation(self): + uid = '11189ee47ddf4796b718a483b379f976' + entry = self.collection.entry_from_uid(uid) + self.assertEqual( + str(entry), + uid + ) + label = '{{ uid }}: {{ name }}' + self.collection.settings['entry_label'] = label + self.assertEqual( + str(entry), + '{uid}: {name}'.format(uid=uid, name='Another item') + ) + class testComplexCollection(unittest.TestCase): @classmethod -- cgit v1.2.3