def test_nuke_tables(): 'add a locus to an empty refloci db and then retrieve it' if m80.Tools.available('RefLoci', 'empty'): m80.Tools.delete('RefLoci', 'empty', force=True) empty = RefLoci('empty') assert len(empty) == 0 x = Locus('1', 1, 1, feature_type='gene', attrs={'foo': 'bar'}) y = Locus('1', 2, 2, feature_type='exon', attrs={'baz': 'bat'}) x.add_sublocus(y) LID = empty.add_locus(x) assert len(empty) == 1 empty._nuke_tables() assert len(empty) == 0 m80.Tools.delete('RefLoci', 'empty', force=True)
def test_add_locus_with_subloci(): 'add a locus to an empty refloci db and then retrieve it' if m80.Tools.available('RefLoci', 'empty'): m80.Tools.delete('RefLoci', 'empty', force=True) empty = RefLoci('empty') assert len(empty) == 0 x = Locus('1', 1, 1, feature_type='gene', attrs={'foo': 'bar'}) y = Locus('1', 2, 2, feature_type='exon', attrs={'baz': 'bat'}) x.add_sublocus(y) LID = empty.add_locus(x) assert len(empty) == 1 l = empty._get_locus_by_LID(LID) assert l['foo'] == 'bar' assert len(l.subloci) == 1 m80.Tools.delete('RefLoci', 'empty', force=True)