

@mock.patch.object(migrate.WalkVersionsMixin, 'migrate_up')
@mock.patch.object(migrate.WalkVersionsMixin, 'migrate_down')
def test_walk_versions_all_true(self, migrate_up, migrate_down):
    self.REPOSITORY.latest = versioning_api.VerNum(20)
    self.migration_api.db_version.return_value = self.INIT_VERSION
    self.walk_versions(snake_walk=True, downgrade=True)
    versions = range((int(self.INIT_VERSION) + 1), (int(self.REPOSITORY.latest) + 1))
    upgraded = []
    for v in versions:
        upgraded.append(mock.call(v, with_data=True))
        upgraded.append(mock.call(v))
    upgraded.extend([mock.call(v) for v in reversed(versions)])
    self.assertEqual(upgraded, downgraded_2.migrate_up.call_args_list)
    downgraded_1 = [mock.call((v - 1), with_data=True) for v in versions]
    downgraded_2 = []
    for v in reversed(versions):
        downgraded_2.append(mock.call((v - 1)))
        downgraded_2.append(mock.call((v - 1)))
    downgraded = (downgraded_1 + downgraded_2)
    self.assertEqual(self.migrate_down.call_args_list, downgraded)

dataset/ETHPy150Open openstack/oslo.db/oslo_db/tests/sqlalchemy/test_migrations.py TestWalkVersions.test_walk_versions_all_true/VarMisuse@177/227 `self`->`downgraded_2`