From de1c03d81615e6fd50540008fe6ca46feb012c30 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Wed, 3 Feb 2021 10:45:30 +0100 Subject: Test loading (and rewriting) decimal data. refs: #3 https://todo.sr.ht/~valhalla/lesana/3 --- tests/test_collection.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/test_collection.py') diff --git a/tests/test_collection.py b/tests/test_collection.py index b25dfa1..6a6e5e3 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -261,6 +261,18 @@ class testSimpleCollection(unittest.TestCase): ).data['position'] ) + def test_representation_decimal(self): + entry = self.collection.entry_from_eid( + '085682ed6792499da3ab9aebd683c011' + ) + data = ruamel.yaml.safe_load(entry.yaml_data) + self.assertEqual(data['cost'], '1.99') + + fname = 'tests/data/simple/items/' + \ + '085682ed-6792-499d-a3ab-9aebd683c011.yaml' + with open(fname, 'r') as fp: + self.assertEqual(entry.yaml_data, fp.read()) + class testComplexCollection(unittest.TestCase): def setUp(self): -- cgit v1.2.3