예제 #1
0
 def test_get_rel_special_chars_wc(self):
     """Get relations containing wildcard characters"""
     testdb = DB(SQLiteRepo())
     init = (('a***', 10), ('b???', 20), ('R?*', 'a***', 'b???', None))
     testdb.import_data(init)
     expected = ('R?*', 'a***', 'b???', None)
     samp = next(testdb.get_rels(a_from='a**',
                                 out_format='interchange'))
     self.assertEqual(samp, expected)
예제 #2
0
 def test_get_rel_long_name_wildcard(self):
     """Get relations with long names by name wildcard"""
     testrepo = SQLiteRepo()
     testdb = DB(testrepo)
     plen = testrepo.preface_length
     suffix = "N" * plen
     long_name = f"R{suffix}"
     init = (('a', 0), ('b', 1), ("R", 1), (long_name, 'a', 'b', 100))
     expected = [
         (long_name, 'a', 'b', 100),
     ]
     testdb.import_data(init)
     samp = list(testdb.get_rels(name="R*", out_format='interchange'))
     self.assertEqual(samp, expected)
예제 #3
0
 def test_get_rel_long_content(self):
     """Get relations between anchors with long content"""
     testrepo = SQLiteRepo()
     testdb = DB(testrepo)
     plen = testrepo.preface_length
     suffix = "N" * plen
     long_content_a = "{}{}".format("A", suffix)
     long_content_z = "{}{}".format("Z", suffix)
     init = ((long_content_a, 0), (long_content_z, 0), ("R", 1),
             ("R", long_content_a[:plen], long_content_z[:plen], None))
     expected = [
         ("R", long_content_a[:plen], long_content_z[:plen], None),
     ]
     testdb.import_data(init)
     samp = list(testdb.get_rels(name="*", out_format='interchange'))
     self.assertEqual(samp, expected)