Exemplo n.º 1
0
 def testAddSameSubjectIncreasesBackendSize(self):
     """
     If an identical subject is added multiple times, the backend size
     does not increase, because the backend subject store detect duplicates.
     """
     dbParams = DatabaseParameters(landmarks=[AlphaHelix], trigPoints=[])
     be = Backend()
     be.configure(dbParams)
     be.addSubject(AARead('id', 'FRRRFRRRF'), '0')
     self.assertEqual(1, be.subjectCount())
     be.addSubject(AARead('id', 'FRRRFRRRF'), '0')
     self.assertEqual(1, be.subjectCount())
Exemplo n.º 2
0
 def testSaveRestoreNonEmpty(self):
     """
     When asked to save and then restore a non-empty backend, the correct
     backend must result.
     """
     dbParams = DatabaseParameters(landmarks=[AlphaHelix, BetaStrand],
                                   trigPoints=[Peaks, Troughs])
     be = Backend()
     be.configure(dbParams)
     be.addSubject(AARead('id', 'FRRRFRRRFASAASA'), '0')
     fp = StringIO()
     be.save(fp)
     fp.seek(0)
     result = Backend.restore(fp)
     self.assertEqual(be.subjectCount(), result.subjectCount())
     self.assertEqual(be.d, result.d)
     self.assertEqual(be.checksum(), result.checksum())
     self.assertIs(None, be.dbParams.compare(result.dbParams))