diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2021-02-03 10:45:30 +0100 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2021-02-03 10:45:37 +0100 |
commit | de1c03d81615e6fd50540008fe6ca46feb012c30 (patch) | |
tree | 202179417b417e08bbc4b0f0627b7539b15b5d3c /tests | |
parent | 48deffbba075a1920947d1879fd6731d6bfc259e (diff) |
Test loading (and rewriting) decimal data. refs: #3
https://todo.sr.ht/~valhalla/lesana/3
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/simple/items/085682ed-6792-499d-a3ab-9aebd683c011.yaml | 7 | ||||
-rw-r--r-- | tests/test_collection.py | 12 |
2 files changed, 16 insertions, 3 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 99431b1..4648a5e 100644 --- a/tests/data/simple/items/085682ed-6792-499d-a3ab-9aebd683c011.yaml +++ b/tests/data/simple/items/085682ed-6792-499d-a3ab-9aebd683c011.yaml @@ -1,9 +1,10 @@ name: One Item description: | - This is a long block of text - that spans multiple lines. + This is a long block of text + that spans multiple lines. position: somewhere quantity: 2 value: 0.8 -cost: 1.99 +cost: '1.99' eid: 085682ed6792499da3ab9aebd683c011 +other: some data 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): |