aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2017-01-02 16:16:55 +0100
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2017-01-02 16:16:55 +0100
commit76cc206a8735a22ba605ceb03d48e09984bb43fd (patch)
treec019da2608dfebd4c052a45b49bf2327acd0361d /tests
parent5e63c3127cd82a187fdb6c227e5e0538212763b2 (diff)
suppress warning about unsafe loading of yaml
Diffstat (limited to 'tests')
-rw-r--r--tests/test_collection.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/test_collection.py b/tests/test_collection.py
index 7d2dc72..a55261f 100644
--- a/tests/test_collection.py
+++ b/tests/test_collection.py
@@ -76,7 +76,6 @@ class testCollectionLoading(unittest.TestCase):
self.assertEqual(entry.uid, '11189ee47ddf4796b718a483b379f976')
-
class testEntries(unittest.TestCase):
def setUp(self):
self.collection = lesana.Collection('tests/data/simple')
@@ -89,13 +88,13 @@ class testEntries(unittest.TestCase):
def test_simple(self):
fname = '085682ed-6792-499d-a3ab-9aebd683c011.yaml'
with open(os.path.join(self.basepath, fname)) as fp:
- data = ruamel.yaml.load(fp)
+ data = ruamel.yaml.safe_load(fp)
entry = lesana.Entry(self.collection, data=data, fname=fname)
self.assertEqual(entry.idterm, 'Q'+data['uid'])
fname = '11189ee47ddf4796b718a483b379f976.yaml'
uid = '11189ee47ddf4796b718a483b379f976'
with open(os.path.join(self.basepath, fname)) as fp:
- data = ruamel.yaml.load(fp)
+ data = ruamel.yaml.safe_load(fp)
entry = lesana.Entry(self.collection, data=data, fname=fname)
self.assertEqual(entry.idterm, 'Q'+uid)
@@ -104,7 +103,7 @@ class testEntries(unittest.TestCase):
self.collection.save_entries(entries=[new_entry])
entry_fname = 'tests/data/simple/items/' + new_entry.fname
with open(entry_fname) as fp:
- written = ruamel.yaml.load(fp)
+ written = ruamel.yaml.safe_load(fp)
self.assertIsInstance(written['quantity'], int)
self.assertIsInstance(written['name'], str)
os.remove(entry_fname)