summaryrefslogtreecommitdiff
path: root/tests/test_collection.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_collection.py')
-rw-r--r--tests/test_collection.py86
1 files changed, 43 insertions, 43 deletions
diff --git a/tests/test_collection.py b/tests/test_collection.py
index 23186a1..b5266d9 100644
--- a/tests/test_collection.py
+++ b/tests/test_collection.py
@@ -104,31 +104,31 @@ class testCollection(unittest.TestCase):
for m in matches:
self.assertIsInstance(m, lesana.Entry)
- def test_entry_from_uid(self):
+ def test_entry_from_eid(self):
self.collection = lesana.Collection('tests/data/simple')
- entry = self.collection.entry_from_uid(
+ entry = self.collection.entry_from_eid(
'11189ee47ddf4796b718a483b379f976'
)
- self.assertEqual(entry.uid, '11189ee47ddf4796b718a483b379f976')
+ self.assertEqual(entry.eid, '11189ee47ddf4796b718a483b379f976')
self.collection.safe = True
- entry = self.collection.entry_from_uid(
+ entry = self.collection.entry_from_eid(
'11189ee47ddf4796b718a483b379f976'
)
- self.assertEqual(entry.uid, '11189ee47ddf4796b718a483b379f976')
+ self.assertEqual(entry.eid, '11189ee47ddf4796b718a483b379f976')
- def test_entry_from_short_uid(self):
+ def test_entry_from_short_eid(self):
self.collection = lesana.Collection('tests/data/simple')
- entries = self.collection.entries_from_short_uid(
+ entries = self.collection.entries_from_short_eid(
'11189ee4'
)
self.assertEqual(len(entries), 1)
- self.assertEqual(entries[0].uid, '11189ee47ddf4796b718a483b379f976')
- entries = self.collection.entries_from_short_uid(
+ self.assertEqual(entries[0].eid, '11189ee47ddf4796b718a483b379f976')
+ entries = self.collection.entries_from_short_eid(
'11189ee47ddf4796b718a483b379f976'
)
self.assertEqual(len(entries), 1)
- self.assertEqual(entries[0].uid, '11189ee47ddf4796b718a483b379f976')
- entries = self.collection.entries_from_short_uid(
+ self.assertEqual(entries[0].eid, '11189ee47ddf4796b718a483b379f976')
+ entries = self.collection.entries_from_short_eid(
'12345678'
)
self.assertEqual(len(entries), 0)
@@ -140,9 +140,9 @@ class testCollection(unittest.TestCase):
self.assertEqual(len(cm.output), 1)
self.assertIn("non_existing_file", cm.output[0])
- def test_get_entry_missing_uid(self):
+ def test_get_entry_missing_eid(self):
self.collection = lesana.Collection('tests/data/simple')
- entry = self.collection.entry_from_uid('this is not an uid')
+ entry = self.collection.entry_from_eid('this is not an eid')
self.assertIsNone(entry)
def test_render_collection(self):
@@ -170,14 +170,14 @@ class testEntries(unittest.TestCase):
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
entry = lesana.Entry(self.collection, data=data, fname=fname)
- self.assertEqual(entry.idterm, 'Q'+data['uid'])
+ self.assertEqual(entry.idterm, 'Q'+data['eid'])
fname = '11189ee47ddf4796b718a483b379f976.yaml'
- uid = '11189ee47ddf4796b718a483b379f976'
+ eid = '11189ee47ddf4796b718a483b379f976'
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
entry = lesana.Entry(self.collection, data=data, fname=fname)
- self.assertEqual(entry.idterm, 'Q'+uid)
- self.assertEqual(entry.short_id, uid[:8])
+ self.assertEqual(entry.idterm, 'Q'+eid)
+ self.assertEqual(entry.short_id, eid[:8])
def test_write_new(self):
new_entry = lesana.Entry(self.collection)
@@ -194,71 +194,71 @@ class testEntries(unittest.TestCase):
self.assertIsInstance(written['name'], str)
def test_entry_representation(self):
- uid = '11189ee47ddf4796b718a483b379f976'
- entry = self.collection.entry_from_uid(uid)
+ eid = '11189ee47ddf4796b718a483b379f976'
+ entry = self.collection.entry_from_eid(eid)
self.assertEqual(
str(entry),
- uid
+ eid
)
- label = '{{ uid }}: {{ name }}'
+ label = '{{ eid }}: {{ name }}'
self.collection.settings['entry_label'] = label
self.assertEqual(
str(entry),
- '{uid}: {name}'.format(uid=uid, name='Another item')
+ '{eid}: {name}'.format(eid=eid, name='Another item')
)
- def test_entry_creation_uid_but_no_filename(self):
+ def test_entry_creation_eid_but_no_filename(self):
fname = '11189ee47ddf4796b718a483b379f976.yaml'
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
- data['uid'] = '11189ee47ddf4796b718a483b379f976'
+ data['eid'] = '11189ee47ddf4796b718a483b379f976'
entry = lesana.Entry(self.collection, data=data)
self.assertEqual(entry.fname, fname)
- def test_entry_creation_no_uid_no_filename(self):
+ def test_entry_creation_no_eid_no_filename(self):
fname = '11189ee47ddf4796b718a483b379f976.yaml'
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
entry = lesana.Entry(self.collection, data=data)
- self.assertIsNotNone(entry.uid)
+ self.assertIsNotNone(entry.eid)
self.assertIsNotNone(entry.fname)
- def test_entry_creation_filename_but_no_uid(self):
+ def test_entry_creation_filename_but_no_eid(self):
fname = '11189ee47ddf4796b718a483b379f976.yaml'
- uid = '11189ee47ddf4796b718a483b379f976'
+ eid = '11189ee47ddf4796b718a483b379f976'
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
entry = lesana.Entry(self.collection, data=data, fname=fname)
- self.assertEqual(entry.uid, uid)
+ self.assertEqual(entry.eid, eid)
- def test_entry_str_filename_and_uid(self):
+ def test_entry_str_filename_and_eid(self):
fname = '11189ee47ddf4796b718a483b379f976.yaml'
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
- data['uid'] = '11189ee47ddf4796b718a483b379f976'
+ data['eid'] = '11189ee47ddf4796b718a483b379f976'
entry = lesana.Entry(self.collection, data=data)
- self.assertEqual(str(entry), data['uid'])
- self.collection.settings['entry_label'] = '{{ uid }}: {{ name }}'
- self.assertEqual(str(entry), data['uid'] + ': Another item')
+ self.assertEqual(str(entry), data['eid'])
+ self.collection.settings['entry_label'] = '{{ eid }}: {{ name }}'
+ self.assertEqual(str(entry), data['eid'] + ': Another item')
- def test_entry_str_filename_no_uid(self):
+ def test_entry_str_filename_no_eid(self):
fname = '11189ee47ddf4796b718a483b379f976.yaml'
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
entry = lesana.Entry(self.collection, data=data)
- uid = entry.uid
- self.assertEqual(str(entry), uid)
- self.collection.settings['entry_label'] = '{{ uid }}: {{ name }}'
- self.assertEqual(str(entry), uid + ': Another item')
+ eid = entry.eid
+ self.assertEqual(str(entry), eid)
+ self.collection.settings['entry_label'] = '{{ eid }}: {{ name }}'
+ self.assertEqual(str(entry), eid + ': Another item')
def test_render_entry(self):
fname = '11189ee47ddf4796b718a483b379f976.yaml'
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
entry = lesana.Entry(self.collection, data=data)
- uid = entry.uid
+ eid = entry.eid
res = entry.render('tests/data/simple/templates/trivial_template.txt')
- self.assertIn(uid, res)
+ self.assertIn(eid, res)
def test_empty_data(self):
entry = lesana.Entry(self.collection)
@@ -298,7 +298,7 @@ class testComplexCollection(unittest.TestCase):
self.assertIsInstance(m, lesana.Entry)
def test_boolean_field(self):
- entry = self.collection.entry_from_uid(
+ entry = self.collection.entry_from_eid(
'73097121f1874a6ea2f927db7dc4f11e'
)
self.assertIsInstance(entry.data['exists'], bool)
@@ -412,7 +412,7 @@ class testCollectionCreation(unittest.TestCase):
mset = collection._enquire.get_mset(0, 10)
self.assertEqual(mset.get_matches_estimated(), 0)
- def test_partial_uid_deletion(self):
+ def test_partial_eid_deletion(self):
tmpdir = tempfile.mkdtemp()
shutil.copy('tests/data/simple/settings.yaml', tmpdir)
shutil.copytree(