aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lesana/collection.py2
-rw-r--r--tests/test_collection.py7
2 files changed, 4 insertions, 5 deletions
diff --git a/lesana/collection.py b/lesana/collection.py
index ad1c5c2..d1e651f 100644
--- a/lesana/collection.py
+++ b/lesana/collection.py
@@ -54,7 +54,7 @@ class Collection(object):
ruamel.yaml.RoundTripLoader
)
except FileNotFoundError:
- self.settings = ruamel.yaml.load("{}")
+ self.settings = ruamel.yaml.safe_load("{}")
os.makedirs(os.path.join(self.basedir, '.lesana'), exist_ok=True)
if 'lang' in self.settings:
try:
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)