示例#1
0
 def test021_drop(self):
     d = Database(db_path, mode=mode, serializer=serializer)
     c = d.test021
     c.drop()
     self.assertFalse('test021' in d.collection_names(),
                      msg='Nin operand failed')
     d.create_collection('test021')
     d.drop_collection('test021')
     self.assertFalse('test021' in d.collection_names(),
                      msg='Nin operand failed')
示例#2
0
    def test001_newdb(self):
        print('=> %s::%s' % (mode, serializer))
        d = Database(db_path, mode=mode, serializer=serializer)
        d.drop_collection('test')
        d.drop_collection('test2')
        self.assertNotIn('test',
                         d.collection_names(),
                         msg='Database not empty (drop failure)')
        self.assertNotIn('test2',
                         d.collection_names(),
                         msg='Database not empty (drop failure)')
        d.sync()

        _db = _serializer.load()
        self.assertNotIn('test', _db)
        self.assertNotIn('test2', _db)
        self.assertFalse(_db['_infos']['total_entries'] > 0,
                         msg='Ids index is not empty')