def test_schema(self):
        sp_hbb1 = testutil.datafile('sp_hbb1')
        sp2 = seqdb.BlastDB(sp_hbb1)
        sp2.__doc__ = 'another sp'
        self.pygrData.Bio.Seq.sp2 = sp2
        sp = self.pygrData.Bio.Seq.Swissprot.sp42()
        m = mapping.Mapping(sourceDB=sp, targetDB=sp2)
        m.__doc__ = 'sp -> sp2'
        self.pygrData.Bio.Seq.testmap = m
        self.schema.Bio.Seq.testmap = metabase.OneToManyRelation(sp, sp2)
        self.metabase.commit()

        self.metabase.clear_cache()

        sp3 = seqdb.BlastDB(sp_hbb1)
        sp3.__doc__ = 'sp number 3'
        self.pygrData.Bio.Seq.sp3 = sp3
        sp2 = self.pygrData.Bio.Seq.sp2()
        m = mapping.Mapping(sourceDB=sp3, targetDB=sp2)
        m.__doc__ = 'sp3 -> sp2'
        self.pygrData.Bio.Seq.testmap2 = m
        self.schema.Bio.Seq.testmap2 = metabase.OneToManyRelation(sp3, sp2)
        l = self.metabase.resourceCache.keys()
        l.sort()
        assert l == ['Bio.Seq.sp2', 'Bio.Seq.sp3', 'Bio.Seq.testmap2']
        self.metabase.commit()
        g = self.metabase.writer.storage.graph
        expected = set(['Bio.Annotation.annoDB',
                     'Bio.Seq.Swissprot.sp42', 'Bio.Seq.sp2', 'Bio.Seq.sp3'])
        found = set(g.keys())
        self.EQ(len(expected - found), 0)
Test schema
dataset/ETHPy150Open cjlee112/pygr/tests/metabase_test.py/Sequence_Test.test_schema