Repository: Qiskit/qiskit

Issue:
Retire QuantumProgram
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues to confirm this idea does not exist. -->

### What is the expected enhancement?
`QuantumProgram` exists for keeping backwards compatibility but it is deprecated.



Discussion:

Resolving patch:
diff --git a/qiskit/__init__.py b/qiskit/__init__.py
--- a/qiskit/__init__.py
+++ b/qiskit/__init__.py
@@ -31,7 +31,6 @@
 import qiskit.extensions.standard
 import qiskit.extensions.quantum_initializer
 
-from ._quantumprogram import QuantumProgram
 from ._result import Result
 
 from .wrapper._wrapper import (
diff --git a/qiskit/_quantumprogram.py b/qiskit/_quantumprogram.py
deleted file mode 100644
--- a/qiskit/_quantumprogram.py
+++ /dev/null
@@ -1,1248 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2017, IBM.
-#
-# This source code is licensed under the Apache License, Version 2.0 found in
-# the LICENSE.txt file in the root directory of this source tree.
-
-"""
-Qasm Program Class
-"""
-
-import itertools
-import json
-import logging
-import warnings
-
-import qiskit.wrapper
-from qiskit.qobj import qobj_to_dict
-
-from ._classicalregister import ClassicalRegister
-from ._logging import set_qiskit_logger, unset_qiskit_logger
-from ._qiskiterror import QISKitError
-from ._quantumcircuit import QuantumCircuit
-from ._quantumregister import QuantumRegister
-from .mapper import coupling_dict2list
-from .qasm import Qasm
-
-logger = logging.getLogger(__name__)
-
-
-class QuantumProgram(object):
-    """Quantum Program Class.
-
-     Class internal properties.
-
-     Elements that are not python identifiers or string constants are denoted
-     by "--description (type)--". For example, a circuit's name is denoted by
-     "--circuit name (string)--" and might have the value "teleport".
-
-     Internal::
-
-        __quantum_registers (list[dic]): An dictionary of quantum registers
-            used in the quantum program.
-            __quantum_registers =
-                {
-                --register name (string)--: QuantumRegister,
-                }
-        __classical_registers (list[dic]): An ordered list of classical
-            registers used in the quantum program.
-            __classical_registers =
-                {
-                --register name (string)--: ClassicalRegister,
-                }
-        __quantum_program (dic): An dictionary of quantum circuits
-            __quantum_program =
-                {
-                --circuit name (string)--:  --circuit object --,
-                }
-        __init_circuit (obj): A quantum circuit object for the initial quantum
-            circuit
-     """
-    # -- FUTURE IMPROVEMENTS --
-    # TODO: for status results make ALL_CAPS (check) or some unified method
-    # TODO: Jay: coupling_map, basis_gates will move into a config object
-    # only exists once you set the api to use the online backends
-
-    __api = None
-    __api_config = {}
-
-    def __init__(self, specs=None):
-        self.__quantum_registers = {}
-        self.__classical_registers = {}
-        self.__quantum_program = {}  # stores all the quantum programs
-        self.__init_circuit = None  # stores the initial quantum circuit of the program
-        self.__counter = itertools.count()
-        if specs:
-            self.__init_specs(specs)
-
-    def enable_logs(self, level=logging.INFO):
-        """Enable the console output of the logging messages.
-
-        Enable the output of logging messages (above level `level`) to the
-        console, by configuring the `qiskit` logger accordingly.
-
-        Params:
-            level (int): minimum severity of the messages that are displayed.
-
-        Note:
-            This is a convenience method over the standard Python logging
-            facilities, and modifies the configuration of the 'qiskit.*'
-            loggers. If finer control over the logging configuration is needed,
-            it is encouraged to bypass this method.
-        """
-        # Update the handlers and formatters.
-        set_qiskit_logger()
-        # Set the logger level.
-        logging.getLogger('qiskit').setLevel(level)
-
-    def disable_logs(self):
-        """Disable the console output of the logging messages.
-
-        Disable the output of logging messages (above level `level`) to the
-        console, by removing the handlers from the `qiskit` logger.
-
-        Note:
-            This is a convenience method over the standard Python logging
-            facilities, and modifies the configuration of the 'qiskit.*'
-            loggers. If finer control over the logging configuration is needed,
-            it is encouraged to bypass this method.
-        """
-        unset_qiskit_logger()
-
-    ###############################################################
-    # methods to initiate an build a quantum program
-    ###############################################################
-
-    def __init_specs(self, specs):
-        """Populate the Quantum Program Object with initial Specs.
-
-        Args:
-            specs (dict):
-                    Q_SPECS = {
-                        "circuits": [{
-                            "name": "Circuit",
-                            "quantum_registers": [{
-                                "name": "qr",
-                                "size": 4
-                            }],
-                            "classical_registers": [{
-                                "name": "cr",
-                                "size": 4
-                            }]
-                        }],
-        """
-        quantum_r = []
-        classical_r = []
-        if "circuits" in specs:
-            for circuit in specs["circuits"]:
-                quantum_r = self.create_quantum_registers(
-                    circuit["quantum_registers"])
-                classical_r = self.create_classical_registers(
-                    circuit["classical_registers"])
-                self.create_circuit(name=circuit.get("name"), qregisters=quantum_r,
-                                    cregisters=classical_r)
-                # TODO: Jay: I think we should return function handles for the
-                # registers and circuit. So that we dont need to get them after we
-                # create them with get_quantum_register etc
-
-    def create_quantum_register(self, name=None, size=1):
-        """Create a new Quantum Register.
-
-        Args:
-            name (str or None): the name of the quantum register. If None, an
-                automatically generated identifier will be assigned.
-            size (int): the size of the quantum register
-
-        Returns:
-            QuantumRegister: internal reference to a quantum register in
-                __quantum_registers
-
-        Raises:
-            QISKitError: if the register already exists in the program.
-        """
-        if name is not None and name in self.__quantum_registers:
-            if size != len(self.__quantum_registers[name]):
-                raise QISKitError("Can't make this register: Already in"
-                                  " program with different size")
-            logger.info(">> quantum_register exists: %s %s", name, size)
-            return self.__quantum_registers[name]
-
-        if name is None:
-            name = self._create_id('q', self.__quantum_registers)
-
-        if not isinstance(name, str):
-            logger.info(">> quantum_register name is not a valid type: %s ", type(name))
-            raise QISKitError("The register name should be a string "
-                              "(or None for autogenerate a name).")
-
-        self.__quantum_registers[name] = QuantumRegister(size=size, name=name)
-        logger.info(">> new quantum_register created: %s %s", name, size)
-        return self.__quantum_registers[name]
-
-    def destroy_quantum_register(self, name):
-        """Destroy an existing Quantum Register.
-
-        Args:
-            name (str): the name of the quantum register
-
-        Raises:
-            QISKitError: if the register does not exist in the program.
-        """
-        if name not in self.__quantum_registers:
-            raise QISKitError("Can't destroy this register: Not present")
-        else:
-            logger.info(">> quantum_register destroyed: %s", name)
-            del self.__quantum_registers[name]
-
-    def create_quantum_registers(self, register_array):
-        """Create a new set of Quantum Registers based on a array of them.
-
-        Args:
-            register_array (list[dict]): An array of quantum registers in
-                dictionary format. For example::
-
-                    [{"name": "qr", "size": 4},
-                        ...
-                    ]
-
-                Any other key in the dictionary will be ignored. If "name"
-                is not defined (or None) a random name wil be assigned.
-
-        Returns:
-            list(QuantumRegister): Array of quantum registers objects
-        """
-        new_reg = []
-        for reg in register_array:
-            reg = self.create_quantum_register(
-                reg.get('name'), reg["size"])
-            new_reg.append(reg)
-        return new_reg
-
-    def destroy_quantum_registers(self, register_array):
-        """Destroy a set of Quantum Registers based on a array of them.
-
-        Args:
-            register_array (list[dict]): An array of quantum registers in
-                dictionary format. For example::
-
-                    [{"name": "qr"},
-                        ...
-                    ]
-
-                Any other key in the dictionary will be ignored.
-        """
-        for reg in register_array:
-            self.destroy_quantum_register(reg["name"])
-
-    def create_classical_register(self, name=None, size=1):
-        """Create a new Classical Register.
-
-        Args:
-            name (str or None): the name of the classical register. If None, an
-                automatically generated identifier will be assigned..
-            size (int): the size of the classical register
-        Returns:
-            ClassicalRegister: internal reference to a classical register
-                in __classical_registers
-
-        Raises:
-            QISKitError: if the register already exists in the program.
-        """
-        if name is not None and name in self.__classical_registers:
-            if size != len(self.__classical_registers[name]):
-                raise QISKitError("Can't make this register: Already in"
-                                  " program with different size")
-            logger.info(">> classical register exists: %s %s", name, size)
-            return self.__classical_registers[name]
-
-        if name is None:
-            name = self._create_id('c', self.__classical_registers)
-
-        if not isinstance(name, str):
-            logger.info(">> quantum_register name is not a valid type: %s ", type(name))
-            raise QISKitError("The register name should be a string "
-                              "(or None for autogenerate a name).")
-
-        self.__classical_registers[name] = ClassicalRegister(size=size, name=name)
-        logger.info(">> new classical register created: %s %s", name, size)
-        return self.__classical_registers[name]
-
-    def create_classical_registers(self, registers_array):
-        """Create a new set of Classical Registers based on a array of them.
-
-        Args:
-            registers_array (list[dict]): An array of classical registers in
-                dictionary format. For example::
-
-                    [{"name": "cr", "size": 4},
-                        ...
-                    ]
-
-                Any other key in the dictionary will be ignored. If "name"
-                is not defined (or None) a random name wil be assigned.
-
-        Returns:
-            list(ClassicalRegister): Array of classical registers objects
-        """
-        new_reg = []
-        for reg in registers_array:
-            new_reg.append(self.create_classical_register(
-                reg.get("name"), reg["size"]))
-        return new_reg
-
-    def destroy_classical_register(self, name):
-        """Destroy an existing Classical Register.
-
-        Args:
-            name (str): the name of the classical register
-
-        Raises:
-            QISKitError: if the register does not exist in the program.
-        """
-        if name not in self.__classical_registers:
-            raise QISKitError("Can't destroy this register: Not present")
-        else:
-            logger.info(">> classical register destroyed: %s", name)
-            del self.__classical_registers[name]
-
-    def destroy_classical_registers(self, registers_array):
-        """Destroy a set of Classical Registers based on a array of them.
-
-        Args:
-            registers_array (list[dict]): An array of classical registers in
-                dictionary format. For example::
-
-                    [{"name": "cr"},
-                        ...
-                    ]
-
-                Any other key in the dictionary will be ignored.
-        """
-        for reg in registers_array:
-            self.destroy_classical_register(reg["name"])
-
-    def create_circuit(self, name=None, qregisters=None, cregisters=None):
-        """Create a empty Quantum Circuit in the Quantum Program.
-
-        Args:
-            name (str or None): the name of the circuit. If None, an
-                automatically generated identifier will be assigned.
-            qregisters (list(QuantumRegister)): is an Array of Quantum
-                Registers by object reference
-            cregisters (list(ClassicalRegister)): is an Array of Classical
-                Registers by object reference
-
-        Returns:
-            QuantumCircuit: A quantum circuit is created and added to the
-                Quantum Program
-        """
-        if name is None:
-            name = self._create_id('qc', self.__quantum_program.keys())
-        if not qregisters:
-            qregisters = []
-        if not cregisters:
-            cregisters = []
-        quantum_circuit = QuantumCircuit(name=name)
-        if not self.__init_circuit:
-            self.__init_circuit = quantum_circuit
-        for reg in qregisters:
-            quantum_circuit.add(reg)
-        for reg in cregisters:
-            quantum_circuit.add(reg)
-        self.add_circuit(name, quantum_circuit)
-        return self.__quantum_program[name]
-
-    def destroy_circuit(self, name):
-        """Destroy a Quantum Circuit in the Quantum Program. This will not
-        destroy any registers associated with the circuit.
-
-        Args:
-            name (str): the name of the circuit
-
-        Raises:
-            QISKitError: if the register does not exist in the program.
-        """
-        if name not in self.__quantum_program:
-            raise QISKitError("Can't destroy this circuit: Not present")
-        del self.__quantum_program[name]
-
-    def add_circuit(self, name=None, quantum_circuit=None):
-        """Add a new circuit based on an Object representation.
-
-        Args:
-            name (str or None): the name of the circuit to add. If None, an
-                automatically generated identifier will be assigned to the
-                circuit.
-            quantum_circuit (QuantumCircuit): a quantum circuit to add to the
-                program-name
-        Raises:
-            QISKitError: if `quantum_circuit` is None, as the attribute is
-                optional only for not breaking backwards compatibility (as
-                it is placed after an optional argument).
-        """
-        if quantum_circuit is None:
-            raise QISKitError('quantum_circuit is required when invoking '
-                              'add_circuit')
-        if name is None:
-            if quantum_circuit.name:
-                name = quantum_circuit.name
-            else:
-                name = self._create_id('qc', self.__quantum_program.keys())
-                quantum_circuit.name = name
-
-        self.__quantum_program[name] = quantum_circuit
-
-    def load_qasm_file(self, qasm_file, name=None,
-                       basis_gates='u1,u2,u3,cx,id'):
-        """ Load qasm file into the quantum program.
-
-        Args:
-            qasm_file (str): a string for the filename including its location.
-            name (str or None): the name of the quantum circuit after
-                loading qasm text into it. If no name is give the name is of
-                the text file.
-            basis_gates (str): basis gates for the quantum circuit.
-        Returns:
-            str: Adds a quantum circuit with the gates given in the qasm file to the
-            quantum program and returns the name to be used to get this circuit
-        Raises:
-            QISKitError: if the file cannot be read.
-        """
-        warnings.warn(
-            "QuantumProgram.load_qasm_file() will be deprecated in upcoming versions (>0.5.0). "
-            "Using qiskit.load_qasm_file() instead is recommended.", DeprecationWarning)
-        circuit_unrolled = qiskit.wrapper.load_qasm_file(qasm_file, name, basis_gates)
-        self.add_circuit(name, circuit_unrolled)
-        return name
-
-    def load_qasm_text(self, qasm_string, name=None,
-                       basis_gates='u1,u2,u3,cx,id'):
-        """ Load qasm string in the quantum program.
-
-        Args:
-            qasm_string (str): a string for the file name.
-            name (str or None): the name of the quantum circuit after loading qasm
-                text into it. If no name is give the name is of the text file.
-            basis_gates (str): basis gates for the quantum circuit.
-        Returns:
-            str: Adds a quantum circuit with the gates given in the qasm string to
-            the quantum program.
-        """
-        warnings.warn(
-            "QuantumProgram.load_qasm_text() will be deprecated in upcoming versions (>0.5.0). "
-            "Using qiskit.load_qasm_text() instead is recommended.", DeprecationWarning)
-        circuit_unrolled = qiskit.wrapper.load_qasm_string(qasm_string, name, basis_gates)
-        self.add_circuit(name, circuit_unrolled)
-        return name
-
-    def save(self, file_name=None, beauty=False):
-        """ Save Quantum Program in a Json file.
-
-        Args:
-            file_name (str): file name and path.
-            beauty (boolean): save the text with indent 4 to make it readable.
-
-        Returns:
-            dict: The dictionary with the status and result of the operation
-
-        Raises:
-            LookupError: if the file_name is not correct, or writing to the
-                file resulted in an error.
-        """
-        if file_name is None:
-            error = {"status": "Error", "result": "Not filename provided"}
-            raise LookupError(error['result'])
-
-        if beauty:
-            indent = 4
-        else:
-            indent = 0
-
-        elements_to_save = self.__quantum_program
-        elements_saved = {}
-
-        for circuit in elements_to_save:
-            elements_saved[circuit] = {}
-            elements_saved[circuit]["qasm"] = elements_to_save[circuit].qasm()
-
-        try:
-            with open(file_name, 'w') as save_file:
-                json.dump(elements_saved, save_file, indent=indent)
-            return {'status': 'Done', 'result': elements_to_save}
-        except ValueError:
-            error = {'status': 'Error', 'result': 'Some Problem happened to save the file'}
-            raise LookupError(error['result'])
-
-    def load(self, file_name=None):
-        """ Load Quantum Program Json file into the Quantum Program object.
-
-        Args:
-            file_name (str): file name and path.
-
-        Returns:
-            dict: The dictionary with the status and result of the operation
-
-        Raises:
-            LookupError: if the file_name is not correct, or reading from the
-                file resulted in an error.
-        """
-        if file_name is None:
-            error = {"status": "Error", "result": "Not filename provided"}
-            raise LookupError(error['result'])
-
-        try:
-            with open(file_name, 'r') as load_file:
-                elements_loaded = json.load(load_file)
-
-            for circuit in elements_loaded:
-                circuit_qasm = elements_loaded[circuit]["qasm"]
-                elements_loaded[circuit] = Qasm(data=circuit_qasm).parse()
-            self.__quantum_program = elements_loaded
-
-            return {"status": 'Done', 'result': self.__quantum_program}
-
-        except ValueError:
-            error = {'status': 'Error', 'result': 'Some Problem happened to load the file'}
-            raise LookupError(error['result'])
-
-    ###############################################################
-    # methods to get elements from a QuantumProgram
-    ###############################################################
-
-    def get_quantum_register(self, name=None):
-        """Return a Quantum Register by name.
-
-        Args:
-            name (str or None): the name of the quantum register. If None and there is only
-                one quantum register available, returns that one.
-        Returns:
-            QuantumRegister: The quantum register with this name.
-        Raises:
-            KeyError: if the quantum register is not on the quantum program.
-            QISKitError: if the register does not exist in the program.
-        """
-        if name is None:
-            name = self._get_single_item(self.get_quantum_register_names(), "a quantum register")
-        try:
-            return self.__quantum_registers[name]
-        except KeyError:
-            raise KeyError('No quantum register "{0}"'.format(name))
-
-    def get_classical_register(self, name=None):
-        """Return a Classical Register by name.
-
-        Args:
-            name (str or None): the name of the classical register. If None and there is only
-                one classical register available, returns that one.
-        Returns:
-            ClassicalRegister: The classical register with this name.
-
-        Raises:
-            KeyError: if the classical register is not on the quantum program.
-            QISKitError: if the register does not exist in the program.
-        """
-        if name is None:
-            name = self._get_single_item(self.get_classical_register_names(),
-                                         "a classical register")
-        try:
-            return self.__classical_registers[name]
-        except KeyError:
-            raise KeyError('No classical register "{0}"'.format(name))
-
-    def get_quantum_register_names(self):
-        """Return all the names of the quantum Registers."""
-        return sorted(list(self.__quantum_registers.keys()))
-
-    def get_classical_register_names(self):
-        """Return all the names of the classical Registers."""
-        return sorted(list(self.__classical_registers.keys()))
-
-    def get_circuit(self, name=None):
-        """Return a Circuit Object by name.
-
-        Args:
-            name (str or None): the name of the quantum circuit.
-                If None and there is only one circuit available, returns
-                that one.
-        Returns:
-            QuantumCircuit: The quantum circuit with this name
-
-        Raises:
-            KeyError: if the circuit is not on the quantum program.
-            QISKitError: if the register does not exist in the program.
-        """
-        if name is None:
-            name = self._get_single_item(self.get_circuit_names(), "a circuit")
-        try:
-            return self.__quantum_program[name]
-        except KeyError:
-            raise KeyError('No quantum circuit "{0}"'.format(name))
-
-    def get_circuit_names(self):
-        """Return all the names of the quantum circuits."""
-        return sorted(list(self.__quantum_program.keys()))
-
-    def get_qasm(self, name=None):
-        """Get qasm format of circuit by name.
-
-        Args:
-            name (str or None): name of the circuit. If None and only one circuit is
-                available, that one is selected.
-
-        Returns:
-            str: The quantum circuit in qasm format
-
-        Raises:
-            QISKitError: if the register does not exist in the program.
-        """
-        if name is None:
-            name = self._get_single_item(self.get_circuit_names(), "a circuit")
-        quantum_circuit = self.get_circuit(name)
-        return quantum_circuit.qasm()
-
-    def get_qasms(self, list_circuit_name=None):
-        """Get qasm format of circuit by list of names.
-
-        Args:
-            list_circuit_name (list[str] or None): names of the circuit. If None, it gets all the
-                circuits in the program.
-
-        Returns:
-            list(QuantumCircuit): List of quantum circuit in qasm format
-
-        Raises:
-            QISKitError: if the register does not exist in the program.
-        """
-        qasm_source = []
-        if list_circuit_name is None:
-            list_circuit_name = self.get_circuit_names()
-        for name in list_circuit_name:
-            qasm_source.append(self.get_qasm(name))
-        return qasm_source
-
-    def get_initial_circuit(self):
-        """Return the initialization Circuit."""
-        return self.__init_circuit
-
-    ###############################################################
-    # methods for working with backends
-    ###############################################################
-
-    def set_api(self, token, url, hub=None, group=None, project=None,
-                proxies=None, verify=True):
-        """ Setup the API.
-
-        Fills the __api, and __api_config variables.
-        Does not catch exceptions from IBMQuantumExperience.
-
-        Args:
-            token (str): The token used to register on the online backend such
-                as the quantum experience.
-            url (str): The url used for online backend such as the quantum
-                experience.
-            hub (str): The hub used for online backend.
-            group (str): The group used for online backend.
-            project (str): The project used for online backend.
-            proxies (dict): Proxy configuration for the API, as a dict with
-                'urls' and credential keys.
-            verify (bool): If False, ignores SSL certificates errors.
-        Raises:
-            ConnectionError: if the API instantiation failed.
-            QISKitError: if no hub, group or project were specified.
-
-        .. deprecated:: 0.5
-            This method will be deprecated in upcoming versions. Using the
-            API object instead is recommended.
-        """
-        # TODO: remove the tests as well when the deprecation is completed
-
-        warnings.warn(
-            "set_api() will be deprecated in upcoming versions (>0.5.0). "
-            "Using qiskit.register() instead is recommended.", DeprecationWarning)
-        qiskit.wrapper.register(token, url=url,
-                                hub=hub, group=group, project=project,
-                                proxies=proxies, verify=verify)
-
-        # TODO: the setting of self._api and self.__api_config is left for
-        # backwards-compatibility.
-        # pylint: disable=no-member
-        self.__api = qiskit.wrapper._wrapper._DEFAULT_PROVIDER.providers[-1]._api
-        config_dict = {
-            'url': url,
-        }
-        # Only append hub/group/project if they are different than None.
-        if all([hub, group, project]):
-            config_dict.update({
-                'hub': hub,
-                'group': group,
-                'project': project
-            })
-        if proxies:
-            config_dict['proxies'] = proxies
-        self.__api_config["token"] = token
-        self.__api_config["config"] = config_dict.copy()
-
-    def set_api_hubs_config(self, hub, group, project):
-        """Update the API hubs configuration, replacing the previous one.
-
-            hub (str): The hub used for online backend.
-            group (str): The group used for online backend.
-            project (str): The project used for online backend.
-
-        .. deprecated:: 0.5
-            This method will be deprecated in upcoming versions. Using the
-            API object instead is recommended.
-        """
-        warnings.warn(
-            "set_api_hubs_config() will be deprecated in upcoming versions (>0.5.0). "
-            "Using qiskit.register(token, url, hub, group, project) "
-            "instead is recommended.", DeprecationWarning)
-        config_dict = {
-            'hub': hub,
-            'group': group,
-            'project': project
-        }
-
-        for key, value in config_dict.items():
-            self.__api.config[key] = value
-            self.__api_config['config'][key] = value
-
-    def get_api_config(self):
-        """Return the program specs.
-
-        .. deprecated:: 0.5
-            This method will be deprecated in upcoming versions. Using the
-            API object instead is recommended.
-        """
-        warnings.warn(
-            "get_api_config() will be deprecated in upcoming versions (>0.5.0). "
-            "Using qiskit.register() instead is recommended.", DeprecationWarning)
-
-        return self.__api_config
-
-    def get_api(self):
-        """Returns a function handle to the API.
-
-        .. deprecated:: 0.5
-            This method will be deprecated in upcoming versions. Using the
-            API object instead is recommended.
-        """
-        warnings.warn(
-            "get_api() will be deprecated in upcoming versions (>0.5.0). "
-            "Using qiskit.register() instead is recommended.", DeprecationWarning)
-
-        return self.__api
-
-    def available_backends(self, compact=True):
-        """All the backends that are seen by QISKIT.
-
-        .. deprecated:: 0.5
-            This method will be deprecated in upcoming versions. Using the
-            qiskit.backends family of functions instead is recommended.
-        """
-        warnings.warn(
-            "available_backends() will be deprecated in upcoming versions (>0.5.0). "
-            "Using qiskit.available_backends() instead is recommended.",
-            DeprecationWarning)
-
-        return qiskit.wrapper.available_backends(compact=compact)
-
-    def online_backends(self):
-        """Get the online backends.
-
-        Queries network API if it exists and gets the backends that are online.
-
-        Returns:
-            list(str): List of online backends names if the online api has been set or an empty
-                list if it has not been set.
-
-        Raises:
-            ConnectionError: if the API call failed.
-
-        .. deprecated:: 0.5
-            This method will be deprecated in upcoming versions. Using the
-            qiskit.backends family of functions instead is recommended.
-        """
-        warnings.warn(
-            "online_backends() will be deprecated in upcoming versions (>0.5.0). "
-            "Using qiskit.available_backends({'local': False}) is recommended "
-            "instead.", DeprecationWarning)
-
-        return qiskit.wrapper.remote_backends()
-
-    def online_simulators(self):
-        """Gets online simulators via QX API calls.
-
-        Returns:
-            list(str): List of online simulator names.
-
-        Raises:
-            ConnectionError: if the API call failed.
-
-        .. deprecated:: 0.5
-            This method will be deprecated in upcoming versions. Using the
-            qiskit.backends family of functions instead is recommended.
-        """
-        warnings.warn(
-            "online_simulators() will be deprecated in upcoming versions (>0.5.0). "
-            "Using qiskit.available_backends({'local': False, 'simulator': True}) "
-            "is recommended.", DeprecationWarning)
-
-        return qiskit.wrapper.available_backends({'local': False,
-                                                  'simulator': True})
-
-    def online_devices(self):
-        """Gets online devices via QX API calls.
-
-        Returns:
-            list(str): List of online devices names.
-
-        Raises:
-            ConnectionError: if the API call failed.
-
-        .. deprecated:: 0.5
-            This method will be deprecated in upcoming versions. Using the
-            qiskit.backends family of functions instead is recommended.
-        """
-        warnings.warn(
-            "online_devices() will be deprecated in upcoming versions (>0.5.0). "
-            "Using qiskit.available_backends({'local': False, 'simulator': False}) "
-            "is recommended.", DeprecationWarning)
-
-        return qiskit.wrapper.available_backends({'local': False,
-                                                  'simulator': False})
-
-    def get_backend_status(self, backend):
-        """Return the online backend status.
-
-        It uses QX API call or by local backend is the name of the
-        local or online simulator or experiment.
-
-        Args:
-            backend (str): The backend to check
-
-        Returns:
-            dict: {'operational': True}
-
-        Raises:
-            ConnectionError: if the API call failed.
-            ValueError: if the backend is not available.
-
-        .. deprecated:: 0.5
-            This method will be deprecated in upcoming versions. Using the
-            qiskit.backends family of functions instead is recommended.
-        """
-        warnings.warn(
-            "get_backend_status() will be deprecated in upcoming versions (>0.5.0). "
-            "Using qiskit.get_backend('name').status "
-            "instead is recommended.", DeprecationWarning)
-
-        my_backend = qiskit.wrapper.get_backend(backend)
-        return my_backend.status
-
-    def get_backend_configuration(self, backend):
-        """Return the configuration of the backend.
-
-        The return is via QX API call.
-
-        Args:
-            backend (str):  Name of the backend.
-
-        Returns:
-            dict: The configuration of the named backend.
-
-        Raises:
-            ConnectionError: if the API call failed.
-            LookupError: if a configuration for the named backend can't be
-                found.
-
-        .. deprecated:: 0.5
-            This method will be deprecated in upcoming versions. Using the
-            qiskit.backends family of functions instead is recommended.
-        """
-        warnings.warn(
-            "get_backend_configuration() will be deprecated in upcoming versions (>0.5.0). "
-            "Using qiskit.get_backend('name').configuration "
-            "instead is recommended.", DeprecationWarning)
-
-        my_backend = qiskit.wrapper.get_backend(backend)
-        return my_backend.configuration
-
-    def get_backend_calibration(self, backend):
-        """Return the online backend calibrations.
-
-        The return is via QX API call.
-
-        Args:
-            backend (str):  Name of the backend.
-
-        Returns:
-            dict: The calibration of the named backend.
-
-        Raises:
-            ConnectionError: if the API call failed.
-            LookupError: If a configuration for the named backend can't be
-                found.
-
-        .. deprecated:: 0.5
-            This method will be deprecated in upcoming versions. Using the
-            qiskit.backends family of functions instead is recommended.
-        """
-        warnings.warn(
-            "get_backend_calibration() will be deprecated in upcoming versions (>0.5.0). "
-            "Using qiskit.get_backend('name').calibration "
-            "instead is recommended.", DeprecationWarning)
-
-        my_backend = qiskit.wrapper.get_backend(backend)
-        return my_backend.calibration
-
-    def get_backend_parameters(self, backend):
-        """Return the online backend parameters.
-
-        The return is via QX API call.
-
-        Args:
-            backend (str):  Name of the backend.
-
-        Returns:
-            dict: The configuration of the named backend.
-
-        Raises:
-            ConnectionError: if the API call failed.
-            LookupError: If a configuration for the named backend can't be
-                found.
-
-        .. deprecated:: 0.5
-            This method will be deprecated in upcoming versions. Using the
-            qiskit.backends family of functions instead is recommended.
-        """
-        warnings.warn(
-            "get_backend_parameters() will be deprecated in upcoming versions (>0.5.0). "
-            "Using qiskit.get_backend('name').parameters"
-            "instead is recommended.", DeprecationWarning)
-
-        my_backend = qiskit.wrapper.get_backend(backend)
-        return my_backend.parameters
-
-    ###############################################################
-    # methods to compile quantum programs into qobj
-    ###############################################################
-
-    def compile(self, name_of_circuits=None, backend="local_qasm_simulator",
-                config=None, basis_gates=None, coupling_map=None,
-                initial_layout=None, shots=1024, max_credits=10, seed=None,
-                qobj_id=None, hpc=None, skip_transpiler=False):
-        """Compile the circuits into the execution list.
-
-        .. deprecated:: 0.5
-            The `coupling_map` parameter as a dictionary will be deprecated in
-            upcoming versions. Using the coupling_map as a list is recommended.
-        """
-        # pylint: disable=missing-param-doc, missing-type-doc
-        if isinstance(coupling_map, dict):
-            coupling_map = coupling_dict2list(coupling_map)
-            warnings.warn(
-                "coupling_map as a dictionary will be deprecated in upcoming versions (>0.5.0). "
-                "Using the coupling_map as a list is recommended.", DeprecationWarning)
-
-        list_of_circuits = []
-        if not name_of_circuits:
-            logger.info('Since not circuits was specified, all the circuits will be compiled.')
-            name_of_circuits = self.get_circuit_names()
-        if isinstance(name_of_circuits, str):
-            name_of_circuits = [name_of_circuits]
-        if name_of_circuits:
-            for name in name_of_circuits:
-                self.__quantum_program[name].name = name
-                list_of_circuits.append(self.__quantum_program[name])
-
-        my_backend = qiskit.wrapper.get_backend(backend)
-        qobj = qiskit.wrapper.compile(list_of_circuits, my_backend,
-                                      config, basis_gates, coupling_map, initial_layout,
-                                      shots, max_credits, seed, qobj_id, hpc,
-                                      skip_transpiler)
-        return qobj
-
-    def reconfig(self, qobj, backend=None, config=None, shots=None, max_credits=None, seed=None):
-        """Change configuration parameters for a compile qobj. Only parameters which
-        don't affect the circuit compilation can change, e.g., the coupling_map
-        cannot be changed here!
-
-        Notes:
-            If the inputs are left as None then the qobj is not updated
-
-        Args:
-            qobj (Qobj): already compile qobj
-            backend (str): see .compile
-            config (dict): see .compile
-            shots (int): see .compile
-            max_credits (int): see .compile
-            seed (int): see .compile
-
-        Returns:
-            qobj: updated qobj
-        """
-        if backend is not None:
-            qobj.config.backend = backend
-        if shots is not None:
-            qobj.config.shots = shots
-        if max_credits is not None:
-            qobj.config.max_credits = max_credits
-
-        for experiment in qobj.experiments:
-            if seed is not None:
-                experiment.config.seed = seed
-            if config is not None:
-                for key, value in config.items():
-                    setattr(experiment.config, key, value)
-
-        return qobj
-
-    def get_execution_list(self, qobj, print_func=print):
-        """Print the compiled circuits that are ready to run.
-
-        Note:
-            This method is intended to be used during interactive sessions, and
-            prints directly to stdout instead of using the logger by default. If
-            you set print_func with a log function (eg. log.info) it will be used
-            instead of the stdout.
-
-        Returns:
-            list(str): names of the circuits in `qobj`
-        """
-        if not qobj:
-            print_func("no executions to run")
-        execution_list = []
-
-        qobj = qobj_to_dict(qobj, version='0.0.1')
-
-        print_func("id: %s" % qobj['id'])
-        print_func("backend: %s" % qobj['config']['backend_name'])
-        print_func("qobj config:")
-        for key in qobj['config']:
-            if key != 'backend':
-                print_func(' ' + key + ': ' + str(qobj['config'][key]))
-        for circuit in qobj['circuits']:
-            execution_list.append(circuit["name"])
-            print_func('  circuit name: ' + str(circuit["name"]))
-            print_func('  circuit config:')
-            for key in circuit['config']:
-                print_func('   ' + key + ': ' + str(circuit['config'][key]))
-        return execution_list
-
-    def get_compiled_configuration(self, qobj, name):
-        """Get the compiled layout for the named circuit and backend.
-
-        Args:
-            name (str):  the circuit name
-            qobj (Qobj): the qobj
-
-        Returns:
-            dict: the config of the circuit.
-
-        Raises:
-            QISKitError: if the circuit has no configurations
-        """
-        try:
-            for index in range(len(qobj.experiments)):
-                if qobj.experiments[index].header.name == name:
-                    return qobj.experiments[index].config.as_dict()
-        except KeyError:
-            pass
-        raise QISKitError('No compiled configurations for circuit "{0}"'.format(name))
-
-    def get_compiled_qasm(self, qobj, name):
-        """Return the compiled circuit in qasm format.
-
-        Args:
-            qobj (Qobj): the qobj
-            name (str): name of the quantum circuit
-
-        Returns:
-            str: the QASM of the compiled circuit.
-
-        Raises:
-            QISKitError: if the circuit has no configurations
-        """
-        try:
-            for index in range(len(qobj.experiments)):
-                if qobj.experiments[index].header.name == name:
-                    return qobj.experiments[index].header.compiled_circuit_qasm
-        except KeyError:
-            pass
-        raise QISKitError('No compiled qasm for circuit "{0}"'.format(name))
-
-    ###############################################################
-    # methods to run quantum programs
-    ###############################################################
-
-    def run(self, qobj, timeout=60):
-        """Run a program (a pre-compiled quantum program). This function will
-        block until the Job is processed.
-
-        The program to run is extracted from the qobj parameter.
-
-        Args:
-            qobj (dict): the dictionary of the quantum object to run.
-            timeout (int): Total time to wait until the execution stops
-
-        Returns:
-            Result: A Result (class).
-        """
-        job = self._run_internal([qobj])[0]
-        return job.result(timeout=timeout)
-
-    def run_batch(self, qobj_list, timeout=120):
-        """Run various programs (a list of pre-compiled quantum programs). This
-        function will block until all programs are processed.
-
-        The programs to run are extracted from qobj elements of the list.
-
-        Args:
-            qobj_list (list(dict)): The list of quantum objects to run.
-            timeout (int): Total time to wait until the execution stops
-
-        Returns:
-            list(Result): A list of Result (class). The list will contain one Result object
-            per qobj in the input list.
-        """
-        num_jobs = len(qobj_list)
-        job_results = [None] * num_jobs
-        jobs_list = self._run_internal(qobj_list)
-        while not all(job_results):
-            for i, job in enumerate(jobs_list):
-                if job.done:
-                    job_results[i] = job.result(timeout=timeout)
-        return job_results
-
-    def _run_internal(self, qobj_list):
-        job_list = []
-        for qobj in qobj_list:
-            backend = qiskit.wrapper.get_backend(qobj.header.backend_name)
-            job = backend.run(qobj)
-            job_list.append(job)
-        return job_list
-
-    def execute(self, name_of_circuits=None, backend="local_qasm_simulator",
-                config=None, timeout=60, basis_gates=None,
-                coupling_map=None, initial_layout=None, shots=1024,
-                max_credits=3, seed=None, hpc=None, skip_transpiler=False):
-        """Execute, compile, and run an array of quantum circuits).
-
-        This builds the internal "to execute" list which is list of quantum
-        circuits to run on different backends.
-
-        Args:
-            name_of_circuits (list[str] or str or None): circuit
-                names to be executed. If None, all the circuits will be
-                executed.
-            backend (str): a string representing the backend to compile to.
-            config (dict): a dictionary of configurations parameters for the
-                compiler.
-            timeout (int): Total time to wait until the execution stops
-            basis_gates (str): a comma separated string and are the base gates,
-                               which by default are: u1,u2,u3,cx,id.
-            coupling_map (list): A graph of coupling::
-
-                [
-                    [control0(int), target0(int)],
-                    [control1(int), target1(int)],
-                ]
-
-                eg. [[0, 2], [1, 2], [3, 2]]
-
-            initial_layout (dict): A mapping of qubit to qubit
-                                  {
-                                  ("q", start(int)): ("q", final(int)),
-                                  ...
-                                  }
-                                  eg.
-                                  {
-                                  ("q", 0): ("q", 0),
-                                  ("q", 1): ("q", 1),
-                                  ("q", 2): ("q", 2),
-                                  ("q", 3): ("q", 3)
-                                  }
-            shots (int): the number of shots
-            max_credits (int): the max credits to use 3, or 5
-            seed (int): the initial seed the simulators use
-            hpc (dict): This will setup some parameter for
-                        ibmq_qasm_simulator, using a JSON-like format like::
-
-                            {
-                                'multi_shot_optimization': Boolean,
-                                'omp_num_threads': Numeric
-                            }
-
-            skip_transpiler (bool): If True, bypass most of the compilation process and
-                creates a qobj with minimal check nor translation
-        Returns:
-            Result: status done and populates the internal __quantum_program with the data.
-
-        .. deprecated:: 0.5
-            The `coupling_map` parameter as a dictionary will be deprecated in
-            upcoming versions. Using the coupling_map as a list is recommended.
-        """
-        # pylint: disable=missing-param-doc, missing-type-doc
-        # TODO: Jay: currently basis_gates, coupling_map, initial_layout, shots,
-        # max_credits, and seed are extra inputs but I would like them to go
-        # into the config
-        qobj = self.compile(name_of_circuits=name_of_circuits, backend=backend,
-                            config=config,
-                            basis_gates=basis_gates,
-                            coupling_map=coupling_map, initial_layout=initial_layout,
-                            shots=shots, max_credits=max_credits, seed=seed,
-                            hpc=hpc, skip_transpiler=skip_transpiler)
-        result = self.run(qobj, timeout=timeout)
-        return result
-
-    ###############################################################
-    # utility methods
-    ###############################################################
-
-    @staticmethod
-    def _get_single_item(items, item_description="an item"):
-        """
-        Return the first and only element of `items`, raising an error
-        otherwise.
-
-        Args:
-            items (list): list of items.
-            item_description (string): text description of the item type.
-
-        Returns:
-            object: the first and only element of `items`.
-
-        Raises:
-            QISKitError: if the list does not have exactly one item.
-        """
-        if len(items) == 1:
-            return items[0]
-        else:
-            raise QISKitError(
-                "The name of %s needs to be explicitly indicated, as there is "
-                "more than one available" % item_description)
-
-    def _create_id(self, prefix, existing_ids):
-        """
-        Return an automatically generated identifier, increased sequentially
-        based on the internal `_counter` generator, with the form
-        "[prefix][numeric_id]" (ie. "q2", where the prefix is "q").
-        Args:
-            prefix (str): string to be prepended to the numeric id.
-            existing_ids (iterable): list of ids that should be checked for
-                duplicates.
-
-        Returns:
-            str: the new identifier.
-
-        Raises:
-            QISKitError: if the identifier is already in `existing_ids`.
-        """
-        i = next(self.__counter)
-        identifier = "%s%i" % (prefix, i)
-        if identifier not in existing_ids:
-            return identifier
-        raise QISKitError("The automatically generated identifier '%s' already "
-                          "exists" % identifier)
diff --git a/qiskit/tools/apps/optimization.py b/qiskit/tools/apps/optimization.py
--- a/qiskit/tools/apps/optimization.py
+++ b/qiskit/tools/apps/optimization.py
@@ -1,21 +1,29 @@
 # -*- coding: utf-8 -*-
-
-# Copyright 2017, IBM.
-#
-# This source code is licensed under the Apache License, Version 2.0 found in
-# the LICENSE.txt file in the root directory of this source tree.
-
 # pylint: disable=unused-import,invalid-name
 
+# Copyright 2017 IBM RESEARCH. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# =============================================================================
 """
 These are tools that are used in the classical optimization and chemistry
 tutorials
 """
-import uuid
 import copy
 import numpy as np
 
 from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
+from qiskit import execute
 from qiskit.extensions.standard import h, ry, barrier, cz, x, y, z
 from qiskit.tools.qi.pauli import Pauli, label_to_pauli
 
@@ -50,6 +58,7 @@ def SPSA_optimization(obj_fun, initial_theta, SPSA_parameters, max_trials,
                 optimization in the + direction
             theta_minus_save : array of stored variables of obj_fun along the
                 optimization in the - direction
+        list[QuantumCircuit]: the circuits used in optimization
     """
 
     theta_plus_save = []
@@ -58,6 +67,7 @@ def SPSA_optimization(obj_fun, initial_theta, SPSA_parameters, max_trials,
     cost_minus_save = []
     theta = initial_theta
     theta_best = np.zeros(initial_theta.shape)
+    circuits = []
     for k in range(max_trials):
         # SPSA Paramaters
         a_spsa = float(SPSA_parameters[0]) / np.power(k + 1 +
@@ -70,8 +80,8 @@ def SPSA_optimization(obj_fun, initial_theta, SPSA_parameters, max_trials,
         theta_plus = theta + c_spsa * delta
         theta_minus = theta - c_spsa * delta
         # cost fuction for the two directions
-        cost_plus = obj_fun(theta_plus)
-        cost_minus = obj_fun(theta_minus)
+        cost_plus, circuits_plus = obj_fun(theta_plus)
+        cost_minus, circuits_minus = obj_fun(theta_minus)
         # derivative estimate
         g_spsa = (cost_plus - cost_minus) * delta / (2.0 * c_spsa)
         # updated theta
@@ -86,15 +96,19 @@ def SPSA_optimization(obj_fun, initial_theta, SPSA_parameters, max_trials,
             theta_minus_save.append(theta_minus)
             cost_plus_save.append(cost_plus)
             cost_minus_save.append(cost_minus)
+        # record circuits ran
+        circuits += circuits_plus
+        circuits += circuits_minus
 
         if k >= max_trials - last_avg:
             theta_best += theta / last_avg
 
     # final cost update
-    cost_final = obj_fun(theta_best)
+    cost_final, circuits_final = obj_fun(theta_best)
+    circuits += circuits_final
     print('Final objective function is: %.7f' % cost_final)
     return [cost_final, theta_best, cost_plus_save, cost_minus_save,
-            theta_plus_save, theta_minus_save]
+            theta_plus_save, theta_minus_save], circuits
 
 
 def SPSA_calibration(obj_fun, initial_theta, initial_c, target_update, stat):
@@ -111,6 +125,7 @@ def SPSA_calibration(obj_fun, initial_theta, initial_c, target_update, stat):
             the calibration.
     Returns:
         numpy.array: An array of 5 SPSA_parameters to use in the optimization.
+        list[QuantumCircuit]: the circuits used in calibration
     """
 
     SPSA_parameters = np.zeros((5))
@@ -119,21 +134,24 @@ def SPSA_calibration(obj_fun, initial_theta, initial_c, target_update, stat):
     SPSA_parameters[3] = 0.101
     SPSA_parameters[4] = 0
     delta_obj = 0
+    circuits = []
     for i in range(stat):
         if i % 5 == 0:
             print('calibration step # ' + str(i) + ' of ' + str(stat))
 
         delta = 2 * np.random.randint(2, size=np.shape(initial_theta)[0]) - 1
-        obj_plus = obj_fun(initial_theta + initial_c * delta)
-        obj_minus = obj_fun(initial_theta - initial_c * delta)
+        obj_plus, circuits_plus = obj_fun(initial_theta + initial_c * delta)
+        obj_minus, circuits_minus = obj_fun(initial_theta - initial_c * delta)
         delta_obj += np.absolute(obj_plus - obj_minus) / stat
+        circuits += circuits_plus
+        circuits += circuits_minus
 
     SPSA_parameters[0] = target_update * 2 / delta_obj \
         * SPSA_parameters[1] * (SPSA_parameters[4] + 1)
 
     print('calibrated SPSA_parameters[0] is %.7f' % SPSA_parameters[0])
 
-    return SPSA_parameters
+    return SPSA_parameters, circuits
 
 
 def measure_pauli_z(data, pauli):
@@ -261,13 +279,11 @@ def print_pauli_list_grouped(pauli_list_grouped):
         print('\n')
 
 
-def eval_hamiltonian(Q_program, hamiltonian, input_circuit, shots, device):
+def eval_hamiltonian(hamiltonian, input_circuit, shots, device):
     """Calculates the average value of a Hamiltonian on a state created by the
      input circuit
 
     Args:
-        Q_program (QuantumProgram): QuantumProgram object used to run the
-            input circuit.
         hamiltonian (array or matrix or list): a representation of the
             Hamiltonian or observables to be measured. If it is a list, it is
             a list of Pauli operators grouped into tpb sets.
@@ -279,20 +295,14 @@ def eval_hamiltonian(Q_program, hamiltonian, input_circuit, shots, device):
         float: Average value of the Hamiltonian or observable.
     """
     energy = 0
+    circuits = []
 
     if 'statevector' in device:
+        circuits.append(input_circuit)
         # Hamiltonian is not a pauli_list grouped into tpb sets
         if not isinstance(hamiltonian, list):
-            circuit = ['c' + str(uuid.uuid4())]    # unique random circuit for no collision
-            Q_program.add_circuit(circuit[0], input_circuit)
-            result = Q_program.execute(circuit, device, shots=shots,
-                                       config={"data": ["statevector"]})
-            statevector = result.get_data(circuit[0]).get('statevector')
-            if statevector is None:
-                statevector = result.get_data(
-                    circuit[0]).get('statevector')
-                if statevector:
-                    statevector = statevector[0]
+            result = execute(circuits, device, shots=shots).result()
+            statevector = result.get_statevector()
             # Diagonal Hamiltonian represented by 1D array
             if (hamiltonian.shape[0] == 1 or
                     np.shape(np.shape(np.array(hamiltonian))) == (1,)):
@@ -303,12 +313,6 @@ def eval_hamiltonian(Q_program, hamiltonian, input_circuit, shots, device):
                                   np.dot(hamiltonian, statevector))
         # Hamiltonian represented by a Pauli list
         else:
-            circuits = []
-            circuits_labels = []
-            circuits.append(input_circuit)
-            # Trial circuit w/o the final rotations
-            circuits_labels.append('circuit_label0' + str(uuid.uuid4()))
-            Q_program.add_circuit(circuits_labels[0], circuits[0])
             # Execute trial circuit with final rotations for each Pauli in
             # hamiltonian and store from circuits[1] on
             n_qubits = input_circuit.regs['q'].size
@@ -323,33 +327,25 @@ def eval_hamiltonian(Q_program, hamiltonian, input_circuit, shots, device):
                         circuits[i].z(q[j])
                     elif p[1].v[j] == 1 and p[1].w[j] == 1:
                         circuits[i].y(q[j])
-
-                circuits_labels.append('circuit_label' + str(i) + str(uuid.uuid4()))
-                Q_program.add_circuit(circuits_labels[i], circuits[i])
                 i += 1
-            result = Q_program.execute(circuits_labels, device, shots=shots)
+            result = execute(circuits, device, shots=shots).result()
             # no Pauli final rotations
-            statevector_0 = result.get_data(
-                circuits_labels[0])['statevector']
+            statevector_0 = result.get_statevector(circuits[0])
             i = 1
             for p in hamiltonian:
-                statevector_i = result.get_data(
-                    circuits_labels[i])['statevector']
+                statevector_i = result.get_statevector(circuits[i])
                 # inner product with final rotations of (i-1)-th Pauli
                 energy += p[0] * np.inner(np.conjugate(statevector_0),
                                           statevector_i)
                 i += 1
     # finite number of shots and hamiltonian grouped in tpb sets
     else:
-        circuits = []
-        circuits_labels = []
         n = int(len(hamiltonian[0][0][1].v))
         q = QuantumRegister(n, "q")
         c = ClassicalRegister(n, "c")
         i = 0
         for tpb_set in hamiltonian:
             circuits.append(copy.deepcopy(input_circuit))
-            circuits_labels.append('tpb_circuit_' + str(i) + str(uuid.uuid4()))
             for j in range(n):
                 # Measure X
                 if tpb_set[0][1].v[j] == 0 and tpb_set[0][1].w[j] == 1:
@@ -359,16 +355,15 @@ def eval_hamiltonian(Q_program, hamiltonian, input_circuit, shots, device):
                     circuits[i].s(q[j]).inverse()
                     circuits[i].h(q[j])
                 circuits[i].measure(q[j], c[j])
-            Q_program.add_circuit(circuits_labels[i], circuits[i])
             i += 1
-        result = Q_program.execute(circuits_labels, device, shots=shots)
+        result = execute(circuits, device, shots=shots).result()
         for j, _ in enumerate(hamiltonian):
             for k, _ in enumerate(hamiltonian[j]):
                 energy += hamiltonian[j][k][0] *\
-                    measure_pauli_z(result.get_counts(
-                        circuits_labels[j]), hamiltonian[j][k][1])
+                    measure_pauli_z(result.get_counts(circuits[j]),
+                                    hamiltonian[j][k][1])
 
-    return energy
+    return energy, circuits
 
 
 def trial_circuit_ry(n, m, theta, entangler_map, meas_string=None,


Test patch:
diff --git a/test/performance/state_tomography.py b/test/performance/state_tomography.py
--- a/test/performance/state_tomography.py
+++ b/test/performance/state_tomography.py
@@ -17,8 +17,8 @@
 import time
 
 # import qiskit modules
-from qiskit import QuantumProgram
-from qiskit import QISKitError
+from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
+from qiskit import QISKitError, execute
 
 # import tomography libary and other useful tools
 import qiskit.tools.qcvv.tomography as tomo
@@ -27,42 +27,40 @@
 
 
 # circuit that outputs the target state
-def target_prep(qp, state, target):
+def target_prep(state, target):
     # quantum circuit to make an entangled cat state
     if state == 'cat':
         n_qubits = int(np.log2(target.size))
-        qr = qp.create_quantum_register('qr', n_qubits)
-        cr = qp.create_classical_register('cr', n_qubits)
-        cat = qp.create_circuit('prep', [qr], [cr])
-        cat.h(qr[0])
+        qr = QuantumRegister(n_qubits, 'qr')
+        cr = ClassicalRegister(n_qubits, 'cr')
+        circ = QuantumCircuit(qr, cr, name='cat')
+        circ.h(qr[0])
         for i in range(1, n_qubits):
-            cat.cx(qr[0], qr[i])
+            circ.cx(qr[0], qr[i])
 
     # quantum circuit to prepare arbitrary given state
     elif state == 'random':
         n_qubits = int(np.log2(target.size))
-        qr = qp.create_quantum_register('qr', n_qubits)
-        cr = qp.create_classical_register('cr', n_qubits)
-        random = qp.create_circuit('prep', [qr], [cr])
-        random.initialize("Qinit", target, [qr[i] for i in range(n_qubits)])
+        qr = QuantumRegister(n_qubits, 'qr')
+        cr = ClassicalRegister(n_qubits, 'cr')
+        circ = QuantumCircuit(qr, cr, name='random')
+        circ.initialize("Qinit", target, [qr[i] for i in range(n_qubits)])
 
-    return qp
+    return circ
 
 
-# add basis measurements to the Quantum Program for tomography
+# add basis measurements to the circuit for tomography
 # XX..X, XX..Y, .., ZZ..Z
-def add_tomo_circuits(qp):
+def add_tomo_circuits(circ):
     # Construct state tomography set for measurement of qubits in the register
-    qr_name = list(qp.get_quantum_register_names())[0]
-    cr_name = list(qp.get_classical_register_names())[0]
-    qr = qp.get_quantum_register(qr_name)
-    cr = qp.get_classical_register(cr_name)
+    qr = next(iter(circ.get_qregs().values()))
+    cr = next(iter(circ.get_cregs().values()))
     tomo_set = tomo.state_tomography_set(list(range(qr.size)))
 
-    # Add the state tomography measurement circuits to the Quantum Program
-    tomo_circuits = tomo.create_tomography_circuits(qp, 'prep', qr, cr, tomo_set)
+    # Add the state tomography measurement circuits
+    tomo_circuits = tomo.create_tomography_circuits(circ, qr, cr, tomo_set)
 
-    return qp, tomo_set, tomo_circuits
+    return tomo_set, tomo_circuits
 
 
 # perform quantum state tomography and assess quality of reconstructed vector
@@ -84,19 +82,17 @@ def state_tomography(state, n_qubits, shots):
     # Use the local qasm simulator
     backend = 'local_qasm_simulator'
 
-    qp = QuantumProgram()
-
     # Prepared target state and assess quality
-    qp = target_prep(qp, state, target)
-    prep_result = qp.execute(['prep'], backend='local_statevector_simulator')
-    prep_state = prep_result.get_data('prep')['statevector']
+    prep_circ = target_prep(state, target)
+    prep_result = execute(prep_circ, backend='local_statevector_simulator').result()
+    prep_state = prep_result.get_statevector(prep_circ)
     F_prep = state_fidelity(prep_state, target)
     print('Prepared state fidelity =', F_prep)
 
     # Run state tomography simulation and fit data to reconstruct circuit
-    qp, tomo_set, tomo_circuits = add_tomo_circuits(qp)
-    tomo_result = qp.execute(tomo_circuits, backend=backend, shots=shots)
-    tomo_data = tomo.tomography_data(tomo_result, 'prep', tomo_set)
+    tomo_set, tomo_circuits = add_tomo_circuits(prep_circ)
+    tomo_result = execute(tomo_circuits, backend=backend, shots=shots).result()
+    tomo_data = tomo.tomography_data(tomo_result, prep_circ.name, tomo_set)
     rho_fit = tomo.fit_tomography_data(tomo_data)
 
     # calculate fidelity and purity of fitted state
@@ -105,7 +101,7 @@ def state_tomography(state, n_qubits, shots):
     print('Fitted state fidelity =', F_fit)
     print('Fitted state purity =', str(pur))
 
-    return qp
+    return tomo_circuits
 
 
 if __name__ == '__main__':
@@ -117,12 +113,11 @@ def state_tomography(state, n_qubits, shots):
     args = parser.parse_args()
 
     tstart = time.time()
-    qp = state_tomography(args.state, args.n_qubits, args.shots)
+    tomo_circuits = state_tomography(args.state, args.n_qubits, args.shots)
     tend = time.time()
 
-    all_circuits = list(qp.get_circuit_names())
-    avg = sum(qp.get_qasm(c).count("\n") for c in all_circuits) / len(all_circuits)
+    avg = sum(c.qasm().count("\n") for c in tomo_circuits) / len(tomo_circuits)
 
-    print("---- Number of circuits: {}".format(len(all_circuits)))
+    print("---- Number of circuits: {}".format(len(tomo_circuits)))
     print("---- Avg circuit size: {}".format(avg))
     print("---- Elapsed time: {}".format(tend - tstart))
diff --git a/test/performance/vqe.py b/test/performance/vqe.py
--- a/test/performance/vqe.py
+++ b/test/performance/vqe.py
@@ -20,22 +20,22 @@
 
 # import qiskit modules
 from qiskit import mapper
-from qiskit import QuantumProgram
 from qiskit import QISKitError
 
 # import optimization tools
 from qiskit.tools.apps.optimization import trial_circuit_ryrz, SPSA_optimization, SPSA_calibration
 from qiskit.tools.apps.optimization import Hamiltonian_from_file, make_Hamiltonian
 from qiskit.tools.apps.optimization import eval_hamiltonian, group_paulis
+from qiskit import get_backend
 
 
-def cost_function(qp, H, n_qubits, depth, entangler_map, shots, device, theta):
+def cost_function(H, n_qubits, depth, entangler_map, shots, device, theta):
     trial_circuit = trial_circuit_ryrz(n_qubits, depth, theta, entangler_map,
                                        meas_string=None, measurement=False)
 
-    energy = eval_hamiltonian(qp, H, trial_circuit, shots, device).real
+    energy, circuits = eval_hamiltonian(H, trial_circuit, shots, device)
 
-    return energy
+    return energy.real, circuits
 
 
 def vqe(molecule='H2', depth=6, max_trials=200, shots=1):
@@ -68,12 +68,13 @@ def vqe(molecule='H2', depth=6, max_trials=200, shots=1):
 
     # Optimization
     device = 'local_qasm_simulator'
-    qp = QuantumProgram()
+    if shots == 1:
+        device = 'local_statevector_simulator'
 
-    if shots != 1:
+    if 'statevector' not in device:
         H = group_paulis(pauli_list)
 
-    entangler_map = qp.get_backend_configuration(device)['coupling_map']
+    entangler_map = get_backend(device).configuration['coupling_map']
 
     if entangler_map == 'all-to-all':
         entangler_map = {i: [j for j in range(n_qubits) if j != i] for i in range(n_qubits)}
@@ -85,12 +86,14 @@ def vqe(molecule='H2', depth=6, max_trials=200, shots=1):
     target_update = 2 * np.pi * 0.1                         # aimed update on first trial
     save_step = 20                                          # print optimization trajectory
 
-    cost = partial(cost_function, qp, H, n_qubits, depth, entangler_map, shots, device)
+    cost = partial(cost_function, H, n_qubits, depth, entangler_map, shots, device)
 
-    SPSA_params = SPSA_calibration(cost, initial_theta, initial_c, target_update, stat=25)
-    output = SPSA_optimization(cost, initial_theta, SPSA_params, max_trials, save_step, last_avg=1)
+    SPSA_params, circuits_cal = SPSA_calibration(cost, initial_theta, initial_c,
+                                                 target_update, stat=25)
+    output, circuits_opt = SPSA_optimization(cost, initial_theta, SPSA_params, max_trials,
+                                             save_step, last_avg=1)
 
-    return qp
+    return circuits_cal + circuits_opt
 
 
 if __name__ == '__main__':
@@ -103,12 +106,11 @@ def vqe(molecule='H2', depth=6, max_trials=200, shots=1):
     args = parser.parse_args()
 
     tstart = time.time()
-    qp = vqe(args.molecule, args.depth, args.max_trials, args.shots)
+    circuits = vqe(args.molecule, args.depth, args.max_trials, args.shots)
     tend = time.time()
 
-    all_circuits = list(qp.get_circuit_names())
-    avg = sum(qp.get_qasm(c).count("\n") for c in all_circuits) / len(all_circuits)
+    avg = sum(c.qasm().count("\n") for c in circuits) / len(circuits)
 
-    print("---- Number of circuits: {}".format(len(all_circuits)))
+    print("---- Number of circuits: {}".format(len(circuits)))
     print("---- Avg circuit size: {}".format(avg))
     print("---- Elapsed time: {}".format(tend - tstart))
diff --git a/test/python/_random_circuit_generator.py b/test/python/_random_circuit_generator.py
deleted file mode 100644
--- a/test/python/_random_circuit_generator.py
+++ /dev/null
@@ -1,307 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2017, IBM.
-#
-# This source code is licensed under the Apache License, Version 2.0 found in
-# the LICENSE.txt file in the root directory of this source tree.
-
-"""Generate random circuits."""
-
-import random
-
-import numpy
-
-from qiskit import (qasm, unroll, ClassicalRegister, QuantumCircuit,
-                    QuantumRegister)
-
-
-def choices(population, weights=None, k=1):
-    """
-    Replacement for `random.choices()`, which is only available in Python 3.6+.
-    TODO: drop once Python 3.6 is required by the sdk.
-    """
-    if weights and sum(weights) != 1:
-        # Normalize the weights if needed, as numpy.random.choice requires so.
-        weights = [float(i)/sum(weights) for i in weights]
-
-    return numpy.random.choice(population, size=k, p=weights)
-
-
-class RandomCircuitGenerator(object):
-    """
-    Generate random size circuits for profiling.
-    """
-    def __init__(self, seed=None,
-                 max_qubits=5, min_qubits=1,
-                 max_depth=100, min_depth=1):
-        """
-        Args:
-          seed (int): Random number seed. If none, don't seed the generator.
-          max_qubits (int): Maximum number of qubits in a circuit.
-          min_qubits (int): Minimum number of operations in a cirucit.
-          max_depth (int): Maximum number of operations in a circuit.
-          min_depth (int): Minimum number of operations in circuit.
-        """
-        self.max_depth = max_depth
-        self.max_qubits = max_qubits
-        self.min_depth = min_depth
-        self.min_qubits = min_qubits
-        self.circuit_list = []
-        self.n_qubit_list = []
-        self.depth_list = []
-        self.basis_gates = None
-        self.circuit_name_list = []
-        if seed is not None:
-            random.seed(a=seed)
-        # specify number of parameters and args for each op
-        # in the standard extension. If type hints (PEP484) are followed
-        # maybe we can guess this. "nregs" are the number of qubits the
-        # operation uses. If nregs=0 then it means either 1 qubit or
-        # 1 register. "nparams" are the number of parameters the operation takes.
-        self.op_signature = {
-            'barrier': {'nregs': 0, 'nparams': None},
-            'ccx': {'nregs': 3, 'nparams': None},
-            'ch': {'nregs': 2, 'nparams': None},
-            'crz': {'nregs': 2, 'nparams': 1},
-            'cswap': {'nregs': 3, 'nparams': None},
-            'cu1': {'nregs': 2, 'nparams': 1},
-            'cu3': {'nregs': 2, 'nparams': 3},
-            'cx': {'nregs': 2, 'nparams': None},
-            'cy': {'nregs': 2, 'nparams': None},
-            'cz': {'nregs': 2, 'nparams': None},
-            'h': {'nregs': 1, 'nparams': None},
-            'iden': {'nregs': 1, 'nparams': None},
-            'measure': {'nregs': 0, 'nparams': None},
-            'reset': {'nregs': 1, 'nparams': None},
-            'rx': {'nregs': 1, 'nparams': 1},
-            'ry': {'nregs': 1, 'nparams': 1},
-            'rz': {'nregs': 1, 'nparams': 1},
-            's': {'nregs': 1, 'nparams': None},
-            't': {'nregs': 1, 'nparams': None},
-            'u1': {'nregs': 1, 'nparams': 1},
-            'u2': {'nregs': 1, 'nparams': 2},
-            'u3': {'nregs': 1, 'nparams': 3},
-            'x': {'nregs': 1, 'nparams': None},
-            'y': {'nregs': 1, 'nparams': None},
-            'z': {'nregs': 1, 'nparams': None}}
-
-    def add_circuits(self, n_circuits, do_measure=True, basis=None,
-                     basis_weights=None):
-        """Adds circuits to program.
-
-        Generates a circuit with a random number of operations in `basis`.
-        Also adds a random number of measurements in
-        [1,nQubits] to end of circuit.
-
-        Args:
-            n_circuits (int): Number of circuits to add.
-            do_measure (bool): Whether to add measurements.
-            basis (list(str) or None): List of op names. If None, basis
-                is randomly chosen with unique ops in (2,7)
-            basis_weights (list(float) or None): List of weights
-                corresponding to indices in `basis`.
-        Raises:
-            AttributeError: if operation is not recognized.
-        """
-        if basis is None:
-            basis = list(random.sample(self.op_signature.keys(),
-                                       random.randint(2, 7)))
-            basis_weights = [1./len(basis)] * len(basis)
-        if basis_weights is not None:
-            assert len(basis) == len(basis_weights)
-        uop_basis = basis[:]
-        if basis_weights:
-            uop_basis_weights = basis_weights[:]
-        else:
-            uop_basis_weights = None
-        # remove barrier from uop basis if it is specified
-        if 'barrier' in uop_basis:
-            ind = uop_basis.index('barrier')
-            del uop_basis[ind]
-            if uop_basis_weights:
-                del uop_basis_weights[ind]
-        # remove measure from uop basis if it is specified
-        if 'measure' in uop_basis:
-            ind = uop_basis.index('measure')
-            del uop_basis[ind]
-            if uop_basis_weights:
-                del uop_basis_weights[ind]
-        # self.basis_gates = uop_basis
-        self.basis_gates = basis
-        self.circuit_name_list = []
-        # TODO: replace choices with random.choices() when python 3.6 is
-        # required.
-        self.n_qubit_list = choices(
-            range(self.min_qubits, self.max_qubits + 1), k=n_circuits)
-        self.depth_list = choices(
-            range(self.min_depth, self.max_depth + 1), k=n_circuits)
-        for i_circuit in range(n_circuits):
-            n_qubits = self.n_qubit_list[i_circuit]
-            if self.min_regs_exceeds_nqubits(uop_basis, n_qubits):
-                # no gate operation from this circuit can fit in the available
-                # number of qubits.
-                continue
-            depth_cnt = self.depth_list[i_circuit]
-            reg_pop = numpy.arange(1, n_qubits+1)
-            register_weights = reg_pop[::-1].astype(float)
-            register_weights /= register_weights.sum()
-            max_registers = numpy.random.choice(reg_pop, p=register_weights)
-            reg_weight = numpy.ones(max_registers) / float(max_registers)
-            reg_sizes = rand_register_sizes(n_qubits, reg_weight)
-            n_registers = len(reg_sizes)
-            circuit = QuantumCircuit()
-            for i_size, size in enumerate(reg_sizes):
-                cr_name = 'cr' + str(i_size)
-                qr_name = 'qr' + str(i_size)
-                creg = ClassicalRegister(size, cr_name)
-                qreg = QuantumRegister(size, qr_name)
-                circuit.add(qreg, creg)
-            while depth_cnt > 0:
-                # TODO: replace choices with random.choices() when python 3.6
-                # is required.
-                op_name = choices(basis, weights=basis_weights)[0]
-                if hasattr(circuit, op_name):
-                    operator = getattr(circuit, op_name)
-                else:
-                    raise AttributeError('operation \"{0}\"'
-                                         ' not recognized'.format(op_name))
-                n_regs = self.op_signature[op_name]['nregs']
-                n_params = self.op_signature[op_name]['nparams']
-                if n_regs == 0:  # this is a barrier or measure
-                    n_regs = random.randint(1, n_qubits)
-                if n_qubits >= n_regs:
-                    # warning: assumes op function signature specifies
-                    # op parameters before qubits
-                    op_args = []
-                    if n_params:
-                        op_args = [random.random() for _ in range(n_params)]
-                    if op_name == 'measure':
-                        # if measure occurs here, assume it's to do a conditional
-                        # randomly select a register to measure
-                        ireg = random.randint(0, n_registers-1)
-                        qr_name = 'qr' + str(ireg)
-                        cr_name = 'cr' + str(ireg)
-                        qreg = circuit.regs[qr_name]
-                        creg = circuit.regs[cr_name]
-                        for qind in range(qreg.size):
-                            operator(qreg[qind], creg[qind])
-                        ifval = random.randint(0, (1 << qreg.size) - 1)
-                        # TODO: replace choices with random.choices() when
-                        # python 3.6 is required.
-                        uop_name = choices(uop_basis, weights=uop_basis_weights)[0]
-                        if hasattr(circuit, uop_name):
-                            uop = getattr(circuit, uop_name)
-                        else:
-                            raise AttributeError('operation \"{0}\"'
-                                                 ' not recognized'.format(uop_name))
-                        unregs = self.op_signature[uop_name]['nregs']
-                        unparams = self.op_signature[uop_name]['nparams']
-                        if unregs == 0:  # this is a barrier or measure
-                            unregs = random.randint(1, n_qubits)
-                        if qreg.size >= unregs:
-                            qind_list = random.sample(range(qreg.size), unregs)
-                            uop_args = []
-                            if unparams:
-                                uop_args = [random.random() for _ in range(unparams)]
-                            uop_args.extend([qreg[qind] for qind in qind_list])
-                            uop(*uop_args).c_if(creg, ifval)
-                        depth_cnt -= 1
-                    elif op_name == 'barrier':
-                        ireg = random.randint(0, n_registers-1)
-                        qr_name = 'qr' + str(ireg)
-                        qreg = circuit.regs[qr_name]
-                        bar_args = [(qreg, mi) for mi in range(qreg.size)]
-                        operator(*bar_args)
-                    else:
-                        # select random register
-                        ireg = random.randint(0, n_registers-1)
-                        qr_name = 'qr' + str(ireg)
-                        qreg = circuit.regs[qr_name]
-                        if qreg.size >= n_regs:
-                            qind_list = random.sample(range(qreg.size), n_regs)
-                            op_args.extend([qreg[qind] for qind in qind_list])
-                            operator(*op_args)
-                            depth_cnt -= 1
-                        else:
-                            break
-            nmeasure = random.randint(1, n_qubits)
-            m_list = random.sample(range(nmeasure), nmeasure)
-            if do_measure:
-                for qind in m_list:
-                    rind = 0  # register index
-                    cumtot = 0
-                    while qind >= cumtot + circuit.regs['qr' + str(rind)].size:
-                        cumtot += circuit.regs['qr' + str(rind)].size
-                        rind += 1
-                    qrind = int(qind - cumtot)
-                    qreg = circuit.regs['qr'+str(rind)]
-                    creg = circuit.regs['cr'+str(rind)]
-                    circuit.measure(qreg[qrind], creg[qrind])
-            self.circuit_list.append(circuit)
-
-    def min_regs_exceeds_nqubits(self, basis, n_qubits):
-        """Check whether the minimum number of qubits used by the operations
-        in basis is between 1 and the number of qubits.
-
-        Args:
-            basis (list): list of basis names
-            n_qubits (int): number of qubits in circuit
-        Returns:
-            boolean: result of the check.
-        """
-        return not any((n_qubits >= self.op_signature[opName]['nregs'] > 0
-                        for opName in basis))
-
-    def get_circuits(self, format_='dag'):
-        """Get the compiled circuits generated.
-
-        Args:
-            format_ (str, optional): "qasm" | "qobj" | "QuantumCircuit"
-
-        Returns:
-           list: List of Compiled QuantumCircuit objects.
-
-        Raises:
-            NameError: if the output format is not valid.
-        """
-        if format_ == 'qasm':
-            qasm_list = []
-            for circuit in self.circuit_list:
-                qasm_list.append(circuit.qasm())
-            return qasm_list
-        elif format_ == 'qobj':
-            json_list = []
-            for circuit in self.circuit_list:
-                node_circuit = qasm.Qasm(data=circuit.qasm()).parse()
-                unrolled_circuit = unroll.Unroller(
-                    node_circuit,
-                    unroll.JsonBackend(self.basis_gates))
-                json_list.append(unrolled_circuit.execute())
-            return json_list
-        elif format_ == 'QuantumCircuit':
-            qc_list = []
-            for circuit in self.circuit_list:
-                node_circuit = qasm.Qasm(data=circuit.qasm()).parse()
-                unrolled_circuit = unroll.Unroller(
-                    node_circuit,
-                    unroll.CircuitBackend(self.basis_gates))
-                qc_list.append(unrolled_circuit.execute())
-            return qc_list
-        # elif format is 'dag':
-        #     qc_list = []
-        #     for circuit in self.circuit_list:
-        #         node_circuit = qasm.Qasm(data=circuit.qasm()).parse()
-        #         unrolled_circuit = unroll.Unroller(
-        #             node_circuit,
-        #             unroll.DAGBackend(self.basis_gates))
-        #         qc_list.append(unrolled_circuit.execute())
-        #     return qc_list
-        else:
-            raise NameError('Unrecognized circuit output format: "{}"'.format(
-                format_))
-
-
-def rand_register_sizes(n_registers, pvals):
-    """Return a randomly chosen list of nRegisters summing to nQubits."""
-    vector = numpy.random.multinomial(n_registers, pvals)
-    return vector[vector.nonzero()]
diff --git a/test/python/_random_qasm_generator.py b/test/python/_random_qasm_generator.py
deleted file mode 100644
--- a/test/python/_random_qasm_generator.py
+++ /dev/null
@@ -1,93 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2017, IBM.
-#
-# This source code is licensed under the Apache License, Version 2.0 found in
-# the LICENSE.txt file in the root directory of this source tree.
-
-# pylint: disable=missing-docstring
-
-import random
-import uuid
-
-import numpy
-
-from qiskit import QuantumProgram
-
-
-class RandomQasmGenerator(object):
-    """
-    Generate random size circuits for profiling.
-    """
-    def __init__(self, seed=None,
-                 max_qubits=5, min_qubits=1,
-                 max_depth=100, min_depth=1):
-        """
-        Args:
-            seed (int): Random number seed. If none, don't seed the generator.
-            max_qubits (int): Maximum number of qubits in a circuit.
-            min_qubits (int): Minimum number of qubits in a circuit.
-            max_depth (int): Maximum number of operations in a circuit.
-            min_depth (int): Minimum number of operations in a circuit.
-        """
-        self.max_depth = max_depth
-        self.max_qubits = max_qubits
-        self.min_depth = min_depth
-        self.min_qubits = min_qubits
-        self.qprogram = QuantumProgram()
-        self.qreg = self.qprogram.create_quantum_register('qr', max_qubits)
-        self.creg = self.qprogram.create_classical_register('cr', max_qubits)
-        self.circuit_name_list = []
-        self.n_qubit_list = []
-        self.depth_list = []
-        if seed is not None:
-            random.seed(a=seed)
-
-    def add_circuits(self, n_circuits, do_measure=True):
-        """Adds circuits to program.
-
-        Generates a circuit with a random number of operations equally weighted
-        between U3 and CX. Also adds a random number of measurements in
-        [1,nQubits] to end of circuit.
-
-        Args:
-          n_circuits (int): Number of circuits to add.
-          do_measure (boolean): whether to add measurements
-        """
-        self.circuit_name_list = []
-        self.n_qubit_list = numpy.random.choice(
-            range(self.min_qubits, self.max_qubits + 1), size=n_circuits)
-        self.depth_list = numpy.random.choice(
-            range(self.min_depth, self.max_depth + 1), size=n_circuits)
-        for i in range(n_circuits):
-            circuit_name = str(uuid.uuid4())
-            self.circuit_name_list.append(circuit_name)
-            n_qubits = self.n_qubit_list[i]
-            depth = self.depth_list[i]
-            circuit = self.qprogram.create_circuit(circuit_name,
-                                                   [self.qreg], [self.creg])
-            for _ in range(depth):
-                if n_qubits == 1:
-                    op_ind = 0
-                else:
-                    op_ind = random.randint(0, 1)
-                if op_ind == 0:  # U3
-                    qind = random.randint(0, n_qubits-1)
-                    circuit.u3(random.random(), random.random(), random.random(),
-                               self.qreg[qind])
-                elif op_ind == 1:  # CX
-                    source, target = random.sample(range(n_qubits), 2)
-                    circuit.cx(self.qreg[source], self.qreg[target])
-            n_measure = random.randint(1, n_qubits)
-            for _ in range(n_measure):
-                qind = random.randint(0, n_qubits-1)
-                if do_measure:
-                    # doing this if here keeps the RNG from depending on
-                    # whether measurements are done.
-                    circuit.measure(self.qreg[qind], self.creg[qind])
-
-    def get_circuit_names(self):
-        return self.circuit_name_list
-
-    def get_program(self):
-        return self.qprogram
diff --git a/test/python/test_apps.py b/test/python/test_apps.py
--- a/test/python/test_apps.py
+++ b/test/python/test_apps.py
@@ -11,18 +11,15 @@
 
 import unittest
 from unittest.mock import patch
-from functools import partial
 from io import StringIO
 from scipy import linalg as la
 import numpy as np
 
 from qiskit.tools.apps.optimization import make_Hamiltonian, Hamiltonian_from_file, group_paulis, \
-    eval_hamiltonian, trial_circuit_ry, trial_circuit_ryrz, SPSA_calibration, SPSA_optimization, \
-    print_pauli_list_grouped, Energy_Estimate
+        trial_circuit_ry, print_pauli_list_grouped, Energy_Estimate
 from qiskit.tools.apps.fermion import parity_set, update_set, flip_set, fermionic_maps, \
-    two_qubit_reduction
+        two_qubit_reduction
 from qiskit.tools.qi.pauli import Pauli
-from qiskit import QuantumProgram
 
 from .common import QiskitTestCase
 
@@ -56,90 +53,6 @@ def test_trial_functions(self):
         self.log.info(qasm_txt)
         self.assertEqual(len(qasm_txt), 564)
 
-    def test_optimization_of_H2_at_bond_length(self):
-        """From chemistry tutorial, but shorter.
-
-        https://github.com/QISKit/qiskit-tutorial/blob/master/\
-        4_applications/quantum_chemistry.ipynb#Optimization-of-H2-at-bond-length but shorter."""
-        n = 2
-        m = 6
-        device = 'local_statevector_simulator'
-
-        np.random.seed(42)
-        initial_theta = np.random.randn(2 * n * m)
-        entangler_map = {
-            0: [1]}  # the map of two-qubit gates with control at key and target at values
-        shots = 1
-        max_trials = 1
-        ham_name = self._get_resource_path("../performance/H2/H2Equilibrium.txt")
-
-        # Exact Energy
-        pauli_list = Hamiltonian_from_file(ham_name)
-        H = make_Hamiltonian(pauli_list)
-        exact = np.amin(la.eig(H)[0]).real
-        self.log.info('The exact ground state energy is: %s', exact)
-        self.assertEqual(exact, -1.8572746704950902)
-
-        # Optimization
-        Q_program = QuantumProgram()
-
-        def cost_function(Q_program, H, n, m, entangler_map, shots, device, theta):
-            # pylint: disable=missing-docstring
-            return eval_hamiltonian(Q_program, H,
-                                    trial_circuit_ryrz(n, m, theta, entangler_map, None, False),
-                                    shots, device).real
-
-        initial_c = 0.01
-        target_update = 2 * np.pi * 0.1
-
-        expected_stout = ("calibration step # 0 of 1\n"
-                          "calibrated SPSA_parameters[0] is 2.5459894")
-        with patch('sys.stdout', new=StringIO()) as fakeOutput:
-            SPSA_params = SPSA_calibration(partial(cost_function, Q_program, H, n, m, entangler_map,
-                                                   shots, device), initial_theta, initial_c,
-                                           target_update, 1)
-        self.assertMultiLineEqual(fakeOutput.getvalue().strip(), expected_stout)
-
-        expected_stout = ("objective function at theta+ for step # 0\n"
-                          "-1.0909948\n"
-                          "objective function at theta- for step # 0\n"
-                          "-1.0675805\n"
-                          "Final objective function is: -1.2619548")
-        with patch('sys.stdout', new=StringIO()) as fakeOutput:
-            output = SPSA_optimization(
-                partial(cost_function, Q_program, H, n, m, entangler_map, shots, device),
-                initial_theta, SPSA_params, max_trials)
-
-        self.assertMultiLineEqual(fakeOutput.getvalue().strip(), expected_stout)
-
-        output1 = np.array([-2.48391736629, 2.84236721813, -2.3329429812, 4.50366137571,
-                            -3.21478489403, -3.21476847625, 4.55984433481, -2.21319679015,
-                            2.51115713337, 3.52319156289, 2.51721382649, 2.51490176573,
-                            3.22259379087, 1.06735127465, 1.25571368679, 2.41834399006,
-                            1.96780039897, 3.2948788519, 2.07260744378, -4.39293522064,
-                            -1.51498275038, 2.75485521882, 3.04815972399, 1.55588333309])
-        output4 = np.array([0.486714153011, -0.128264301171, 0.637688538101, 1.53302985641,
-                            -0.244153374723, -0.244136956949, 1.58921281551, 0.757434729153,
-                            -0.459474385935, 0.552560043586, -0.453417692812, -0.45572975357,
-                            0.251962271566, -1.90328024466, -1.71491783251, -0.552287529241,
-                            -1.00283112033, 0.324247332595, -0.898024075521, -1.42230370134,
-                            1.45564876892, -0.215776300487, 0.0775282046879, -1.41474818621])
-        output5 = np.array([0.506714153011, -0.148264301171, 0.657688538101, 1.51302985641,
-                            -0.224153374723, -0.224136956949, 1.56921281551, 0.777434729153,
-                            -0.479474385935, 0.532560043586, -0.473417692812, -0.47572975357,
-                            0.231962271566, -1.92328024466, -1.73491783251, -0.572287529241,
-                            -1.02283112033, 0.304247332595, -0.918024075521, -1.40230370134,
-                            1.47564876892, -0.235776300487, 0.0575282046879, -1.43474818621])
-
-        self.assertEqual(6, len(output))
-        np.testing.assert_almost_equal(-1.2619547992193472, output[0])
-        self.assertEqual(output1.all(), output[1].all())
-        np.testing.assert_almost_equal([-1.0909948471209499], output[2])
-        np.testing.assert_almost_equal([-1.0675805189515357], output[3])
-        self.assertEqual(1, len(output[4]))
-        self.assertEqual(output4.all(), output[4][0].all())
-        self.assertEqual(output5.all(), output[5][0].all())
-
     def test_group_paulis(self):
         """ qiskit.tools.apps.optimization.group_paulis function"""
         ham_name = self._get_resource_path("../performance/H2/H2Equilibrium.txt")
@@ -176,29 +89,6 @@ def test_group_paulis(self):
 
         self.assertMultiLineEqual(fakeOutput.getvalue().strip(), expected_stout)
 
-    def test_eval_hamiltonian_pauli_list(self):
-        """
-        Test of trial_circuit_ry and eval_hamiltonian with a pauli list
-        """
-        ham_name = self._get_resource_path("../performance/H2/H2Equilibrium.txt")
-        pauli_list = Hamiltonian_from_file(ham_name)
-        n = 2
-        m = 6
-        device = 'local_statevector_simulator'
-
-        theta = np.array([-0.607547697211, -0.126136414606, - 0.684606358705, 0.928714748593,
-                          -1.84440103405, -0.467002424077, 2.29249034315, 0.488810054396,
-                          0.710266990661, 1.05553444322, 0.0540731003458, 0.257953416342,
-                          0.588281649703, 0.885244238613, -1.01700702421, -0.133693031283,
-                          -0.438185501332, 0.493443494428, -0.199009119848, -1.27498360732,
-                          0.293494154438, 0.108950311827, 0.031726785859, 1.27263986303])
-        entangler_map = {0: [1]}
-
-        energy = eval_hamiltonian(QuantumProgram(), pauli_list,
-                                  trial_circuit_ry(n, m, theta, entangler_map, None, False), 1,
-                                  device)
-        np.testing.assert_almost_equal(-0.45295043823057191 + 3.3552033732997923e-18j, energy)
-
 
 class TestHamiltonian(QiskitTestCase):
     """ Energy_Estimate and make_Hamiltonian functions """
diff --git a/test/python/test_circuit_combine_extend.py b/test/python/test_circuit.py
similarity index 70%
rename from test/python/test_circuit_combine_extend.py
rename to test/python/test_circuit.py
--- a/test/python/test_circuit_combine_extend.py
+++ b/test/python/test_circuit.py
@@ -5,17 +5,91 @@
 # This source code is licensed under the Apache License, Version 2.0 found in
 # the LICENSE.txt file in the root directory of this source tree.
 
-# pylint: disable=unused-import
+# pylint: disable=unused-import,invalid-name
 
-"""Tests for combining and extending circuits across width and depth"""
+"""Test Qiskit's QuantumCircuit class."""
 
 import qiskit.extensions.simulator
-from qiskit import (ClassicalRegister, QISKitError, QuantumCircuit,
-                    QuantumRegister, execute)
+from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
+from qiskit import execute
+from qiskit import QISKitError
 from qiskit.tools.qi.qi import state_fidelity
 from .common import QiskitTestCase
 
 
+class TestCircuit(QiskitTestCase):
+    """QuantumCircuit basic tests."""
+
+    def test_get_qregs(self):
+        """Test getting quantum registers from circuit.
+        """
+        qr1 = QuantumRegister(1)
+        qr2 = QuantumRegister(2)
+        qc = QuantumCircuit(qr1, qr2)
+        q_regs = qc.get_qregs()
+        self.assertEqual(len(q_regs), 2)
+        self.assertEqual(q_regs[qr1.name], qr1)
+        self.assertEqual(q_regs[qr2.name], qr2)
+
+    def test_get_cregs(self):
+        """Test getting classical registers from circuit.
+        """
+        cr1 = ClassicalRegister(1)
+        cr2 = ClassicalRegister(2)
+        cr3 = ClassicalRegister(3)
+        qc = QuantumCircuit(cr1, cr2, cr3)
+        c_regs = qc.get_cregs()
+        self.assertEqual(len(c_regs), 3)
+        self.assertEqual(c_regs[cr1.name], cr1)
+        self.assertEqual(c_regs[cr2.name], cr2)
+
+    def test_circuit_qasm(self):
+        """Test circuit qasm() method.
+        """
+        qr1 = QuantumRegister(1, 'qr1')
+        qr2 = QuantumRegister(2, 'qr2')
+        c = ClassicalRegister(3, 'c')
+        qc = QuantumCircuit(qr1, qr2, c)
+        qc.u1(0.3, qr1[0])
+        qc.u2(0.2, 0.1, qr2[0])
+        qc.u3(0.3, 0.2, 0.1, qr2[1])
+        qc.s(qr2[1])
+        qc.s(qr2[1]).inverse()
+        qc.cx(qr1[0], qr2[1])
+        qc.barrier(qr2)
+        qc.cx(qr2[1], qr1[0])
+        qc.h(qr2[1])
+        qc.x(qr2[1]).c_if(c, 0)
+        qc.y(qr1[0]).c_if(c, 1)
+        qc.z(qr1[0]).c_if(c, 2)
+        qc.barrier(qr1, qr2)
+        qc.measure(qr1[0], c[0])
+        qc.measure(qr2[0], c[1])
+        qc.measure(qr2[1], c[2])
+        expected_qasm = """OPENQASM 2.0;
+include "qelib1.inc";
+qreg qr1[1];
+qreg qr2[2];
+creg c[3];
+u1(0.300000000000000) qr1[0];
+u2(0.200000000000000,0.100000000000000) qr2[0];
+u3(0.300000000000000,0.200000000000000,0.100000000000000) qr2[1];
+s qr2[1];
+sdg qr2[1];
+cx qr1[0],qr2[1];
+barrier qr2[0],qr2[1];
+cx qr2[1],qr1[0];
+h qr2[1];
+if(c==0) x qr2[1];
+if(c==1) y qr1[0];
+if(c==2) z qr1[0];
+barrier qr1[0],qr2[0],qr2[1];
+measure qr1[0] -> c[0];
+measure qr2[0] -> c[1];
+measure qr2[1] -> c[2];\n"""
+        self.assertEqual(qc.qasm(), expected_qasm)
+
+
 class TestCircuitCombineExtend(QiskitTestCase):
     """Test combining and extending of QuantumCircuits."""
 
@@ -66,10 +140,10 @@ def test_combine_circuit_fail(self):
         cr1 = ClassicalRegister(1, "q")
         qc1 = QuantumCircuit(qr1)
         qc2 = QuantumCircuit(qr2)
-        qc3 = QuantumCircuit(cr1)
+        qcr3 = QuantumCircuit(cr1)
 
         self.assertRaises(QISKitError, qc1.__add__, qc2)
-        self.assertRaises(QISKitError, qc1.__add__, qc3)
+        self.assertRaises(QISKitError, qc1.__add__, qcr3)
 
     def test_combine_circuit_extension_instructions(self):
         """Test combining circuits contining barrier, initializer, snapshot
@@ -144,10 +218,10 @@ def test_extend_circuit_fail(self):
         cr1 = ClassicalRegister(1, "q")
         qc1 = QuantumCircuit(qr1)
         qc2 = QuantumCircuit(qr2)
-        qc3 = QuantumCircuit(cr1)
+        qcr3 = QuantumCircuit(cr1)
 
         self.assertRaises(QISKitError, qc1.__iadd__, qc2)
-        self.assertRaises(QISKitError, qc1.__iadd__, qc3)
+        self.assertRaises(QISKitError, qc1.__iadd__, qcr3)
 
     def test_extend_circuit_extension_instructions(self):
         """Test extending circuits contining barrier, initializer, snapshot
diff --git a/test/python/test_compiler.py b/test/python/test_compiler.py
--- a/test/python/test_compiler.py
+++ b/test/python/test_compiler.py
@@ -5,15 +5,17 @@
 # This source code is licensed under the Apache License, Version 2.0 found in
 # the LICENSE.txt file in the root directory of this source tree.
 
+# pylint: disable=invalid-name, redefined-builtin
+
 
 """Compiler Test."""
 
 import unittest
-import qiskit
+from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
 from qiskit import transpiler
 from qiskit import Result
 from qiskit.qobj import Qobj
-from qiskit.wrapper import register, available_backends, get_backend, execute, least_busy
+from qiskit.wrapper import register, available_backends, get_backend, compile, execute, least_busy
 from qiskit._qiskiterror import QISKitError
 from .common import requires_qe_access, QiskitTestCase
 
@@ -44,9 +46,9 @@ def test_compile(self):
         """
         backend = get_backend('local_qasm_simulator')
 
-        qubit_reg = qiskit.QuantumRegister(2, name='q')
-        clbit_reg = qiskit.ClassicalRegister(2, name='c')
-        qc = qiskit.QuantumCircuit(qubit_reg, clbit_reg, name="bell")
+        qubit_reg = QuantumRegister(2, name='q')
+        clbit_reg = ClassicalRegister(2, name='c')
+        qc = QuantumCircuit(qubit_reg, clbit_reg, name="bell")
         qc.h(qubit_reg[0])
         qc.cx(qubit_reg[0], qubit_reg[1])
         qc.measure(qubit_reg, clbit_reg)
@@ -63,15 +65,15 @@ def test_compile_two(self):
         """
         backend = get_backend('local_qasm_simulator')
 
-        qubit_reg = qiskit.QuantumRegister(2)
-        clbit_reg = qiskit.ClassicalRegister(2)
-        qubit_reg2 = qiskit.QuantumRegister(2)
-        clbit_reg2 = qiskit.ClassicalRegister(2)
-        qc = qiskit.QuantumCircuit(qubit_reg, clbit_reg, name="bell")
+        qubit_reg = QuantumRegister(2)
+        clbit_reg = ClassicalRegister(2)
+        qubit_reg2 = QuantumRegister(2)
+        clbit_reg2 = ClassicalRegister(2)
+        qc = QuantumCircuit(qubit_reg, clbit_reg, name="bell")
         qc.h(qubit_reg[0])
         qc.cx(qubit_reg[0], qubit_reg[1])
         qc.measure(qubit_reg, clbit_reg)
-        qc_extra = qiskit.QuantumCircuit(qubit_reg, qubit_reg2, clbit_reg, clbit_reg2, name="extra")
+        qc_extra = QuantumCircuit(qubit_reg, qubit_reg2, clbit_reg, clbit_reg2, name="extra")
         qc_extra.measure(qubit_reg, clbit_reg)
         qobj = transpiler.compile([qc, qc_extra], backend)
 
@@ -85,9 +87,9 @@ def test_compile_run(self):
         """
         backend = get_backend('local_qasm_simulator')
 
-        qubit_reg = qiskit.QuantumRegister(2, name='q')
-        clbit_reg = qiskit.ClassicalRegister(2, name='c')
-        qc = qiskit.QuantumCircuit(qubit_reg, clbit_reg, name="bell")
+        qubit_reg = QuantumRegister(2, name='q')
+        clbit_reg = ClassicalRegister(2, name='c')
+        qc = QuantumCircuit(qubit_reg, clbit_reg, name="bell")
         qc.h(qubit_reg[0])
         qc.cx(qubit_reg[0], qubit_reg[1])
         qc.measure(qubit_reg, clbit_reg)
@@ -103,13 +105,13 @@ def test_compile_two_run(self):
         """
         backend = get_backend('local_qasm_simulator')
 
-        qubit_reg = qiskit.QuantumRegister(2, name='q')
-        clbit_reg = qiskit.ClassicalRegister(2, name='c')
-        qc = qiskit.QuantumCircuit(qubit_reg, clbit_reg, name="bell")
+        qubit_reg = QuantumRegister(2, name='q')
+        clbit_reg = ClassicalRegister(2, name='c')
+        qc = QuantumCircuit(qubit_reg, clbit_reg, name="bell")
         qc.h(qubit_reg[0])
         qc.cx(qubit_reg[0], qubit_reg[1])
         qc.measure(qubit_reg, clbit_reg)
-        qc_extra = qiskit.QuantumCircuit(qubit_reg, clbit_reg, name="extra")
+        qc_extra = QuantumCircuit(qubit_reg, clbit_reg, name="extra")
         qc_extra.measure(qubit_reg, clbit_reg)
         qobj = transpiler.compile([qc, qc_extra], backend)
         result = backend.run(qobj).result()
@@ -122,9 +124,9 @@ def test_execute(self):
         """
         backend = get_backend('local_qasm_simulator')
 
-        qubit_reg = qiskit.QuantumRegister(2)
-        clbit_reg = qiskit.ClassicalRegister(2)
-        qc = qiskit.QuantumCircuit(qubit_reg, clbit_reg)
+        qubit_reg = QuantumRegister(2)
+        clbit_reg = ClassicalRegister(2)
+        qc = QuantumCircuit(qubit_reg, clbit_reg)
         qc.h(qubit_reg[0])
         qc.cx(qubit_reg[0], qubit_reg[1])
         qc.measure(qubit_reg, clbit_reg)
@@ -139,13 +141,13 @@ def test_execute_two(self):
         """
         backend = get_backend('local_qasm_simulator')
 
-        qubit_reg = qiskit.QuantumRegister(2)
-        clbit_reg = qiskit.ClassicalRegister(2)
-        qc = qiskit.QuantumCircuit(qubit_reg, clbit_reg)
+        qubit_reg = QuantumRegister(2)
+        clbit_reg = ClassicalRegister(2)
+        qc = QuantumCircuit(qubit_reg, clbit_reg)
         qc.h(qubit_reg[0])
         qc.cx(qubit_reg[0], qubit_reg[1])
         qc.measure(qubit_reg, clbit_reg)
-        qc_extra = qiskit.QuantumCircuit(qubit_reg, clbit_reg)
+        qc_extra = QuantumCircuit(qubit_reg, clbit_reg)
         qc_extra.measure(qubit_reg, clbit_reg)
         job = execute([qc, qc_extra], backend)
         results = job.result()
@@ -161,9 +163,9 @@ def test_compile_remote(self, qe_token, qe_url):
         backend = least_busy(available_backends())
         backend = get_backend(backend)
 
-        qubit_reg = qiskit.QuantumRegister(2, name='q')
-        clbit_reg = qiskit.ClassicalRegister(2, name='c')
-        qc = qiskit.QuantumCircuit(qubit_reg, clbit_reg, name="bell")
+        qubit_reg = QuantumRegister(2, name='q')
+        clbit_reg = ClassicalRegister(2, name='c')
+        qc = QuantumCircuit(qubit_reg, clbit_reg, name="bell")
         qc.h(qubit_reg[0])
         qc.cx(qubit_reg[0], qubit_reg[1])
         qc.measure(qubit_reg, clbit_reg)
@@ -183,13 +185,13 @@ def test_compile_two_remote(self, qe_token, qe_url):
         backend = least_busy(available_backends())
         backend = get_backend(backend)
 
-        qubit_reg = qiskit.QuantumRegister(2, name='q')
-        clbit_reg = qiskit.ClassicalRegister(2, name='c')
-        qc = qiskit.QuantumCircuit(qubit_reg, clbit_reg, name="bell")
+        qubit_reg = QuantumRegister(2, name='q')
+        clbit_reg = ClassicalRegister(2, name='c')
+        qc = QuantumCircuit(qubit_reg, clbit_reg, name="bell")
         qc.h(qubit_reg[0])
         qc.cx(qubit_reg[0], qubit_reg[1])
         qc.measure(qubit_reg, clbit_reg)
-        qc_extra = qiskit.QuantumCircuit(qubit_reg, clbit_reg, name="extra")
+        qc_extra = QuantumCircuit(qubit_reg, clbit_reg, name="extra")
         qc_extra.measure(qubit_reg, clbit_reg)
         qobj = transpiler.compile([qc, qc_extra], backend)
 
@@ -205,9 +207,9 @@ def test_compile_run_remote(self, qe_token, qe_url):
         register(qe_token, qe_url)
         backend = available_backends({'local': False, 'simulator': True})[0]
         backend = get_backend(backend)
-        qubit_reg = qiskit.QuantumRegister(2, name='q')
-        clbit_reg = qiskit.ClassicalRegister(2, name='c')
-        qc = qiskit.QuantumCircuit(qubit_reg, clbit_reg, name="bell")
+        qubit_reg = QuantumRegister(2, name='q')
+        clbit_reg = ClassicalRegister(2, name='c')
+        qc = QuantumCircuit(qubit_reg, clbit_reg, name="bell")
         qc.h(qubit_reg[0])
         qc.cx(qubit_reg[0], qubit_reg[1])
         qc.measure(qubit_reg, clbit_reg)
@@ -225,13 +227,13 @@ def test_compile_two_run_remote(self, qe_token, qe_url):
         register(qe_token, qe_url)
         backend = available_backends({'local': False, 'simulator': True})[0]
         backend = get_backend(backend)
-        qubit_reg = qiskit.QuantumRegister(2, name='q')
-        clbit_reg = qiskit.ClassicalRegister(2, name='c')
-        qc = qiskit.QuantumCircuit(qubit_reg, clbit_reg, name="bell")
+        qubit_reg = QuantumRegister(2, name='q')
+        clbit_reg = ClassicalRegister(2, name='c')
+        qc = QuantumCircuit(qubit_reg, clbit_reg, name="bell")
         qc.h(qubit_reg[0])
         qc.cx(qubit_reg[0], qubit_reg[1])
         qc.measure(qubit_reg, clbit_reg)
-        qc_extra = qiskit.QuantumCircuit(qubit_reg, clbit_reg, name="extra")
+        qc_extra = QuantumCircuit(qubit_reg, clbit_reg, name="extra")
         qc_extra.measure(qubit_reg, clbit_reg)
         qobj = transpiler.compile([qc, qc_extra], backend, seed=TestCompiler.seed)
         job = backend.run(qobj)
@@ -247,9 +249,9 @@ def test_execute_remote(self, qe_token, qe_url):
         register(qe_token, qe_url)
         backend = available_backends({'local': False, 'simulator': True})[0]
         backend = get_backend(backend)
-        qubit_reg = qiskit.QuantumRegister(2)
-        clbit_reg = qiskit.ClassicalRegister(2)
-        qc = qiskit.QuantumCircuit(qubit_reg, clbit_reg)
+        qubit_reg = QuantumRegister(2)
+        clbit_reg = ClassicalRegister(2)
+        qc = QuantumCircuit(qubit_reg, clbit_reg)
         qc.h(qubit_reg[0])
         qc.cx(qubit_reg[0], qubit_reg[1])
         qc.measure(qubit_reg, clbit_reg)
@@ -267,13 +269,13 @@ def test_execute_two_remote(self, qe_token, qe_url):
         register(qe_token, qe_url)
         backend = available_backends({'local': False, 'simulator': True})[0]
         backend = get_backend(backend)
-        qubit_reg = qiskit.QuantumRegister(2)
-        clbit_reg = qiskit.ClassicalRegister(2)
-        qc = qiskit.QuantumCircuit(qubit_reg, clbit_reg)
+        qubit_reg = QuantumRegister(2)
+        clbit_reg = ClassicalRegister(2)
+        qc = QuantumCircuit(qubit_reg, clbit_reg)
         qc.h(qubit_reg[0])
         qc.cx(qubit_reg[0], qubit_reg[1])
         qc.measure(qubit_reg, clbit_reg)
-        qc_extra = qiskit.QuantumCircuit(qubit_reg, clbit_reg)
+        qc_extra = QuantumCircuit(qubit_reg, clbit_reg)
         qc_extra.measure(qubit_reg, clbit_reg)
         job = execute([qc, qc_extra], backend, seed=TestCompiler.seed)
         results = job.result()
@@ -283,9 +285,9 @@ def test_mapping_correction(self):
         """Test mapping works in previous failed case.
         """
         backend = FakeBackEnd()
-        qr = qiskit.QuantumRegister(name='qr', size=11)
-        cr = qiskit.ClassicalRegister(name='qc', size=11)
-        circuit = qiskit.QuantumCircuit(qr, cr)
+        qr = QuantumRegister(name='qr', size=11)
+        cr = ClassicalRegister(name='qc', size=11)
+        circuit = QuantumCircuit(qr, cr)
         circuit.u3(1.564784764685993, -1.2378965763410095, 2.9746763177861713, qr[3])
         circuit.u3(1.2269835563676523, 1.1932982847014162, -1.5597357740824318, qr[5])
         circuit.cx(qr[5], qr[3])
@@ -349,11 +351,11 @@ def test_mapping_multi_qreg(self):
         """Test mapping works for multiple qregs.
         """
         backend = FakeBackEnd()
-        qr = qiskit.QuantumRegister(3, name='qr')
-        qr2 = qiskit.QuantumRegister(1, name='qr2')
-        qr3 = qiskit.QuantumRegister(4, name='qr3')
-        cr = qiskit.ClassicalRegister(3, name='cr')
-        qc = qiskit.QuantumCircuit(qr, qr2, qr3, cr)
+        qr = QuantumRegister(3, name='qr')
+        qr2 = QuantumRegister(1, name='qr2')
+        qr3 = QuantumRegister(4, name='qr3')
+        cr = ClassicalRegister(3, name='cr')
+        qc = QuantumCircuit(qr, qr2, qr3, cr)
         qc.h(qr[0])
         qc.cx(qr[0], qr2[0])
         qc.cx(qr[1], qr3[2])
@@ -369,9 +371,9 @@ def test_mapping_already_satisfied(self):
         """Test compiler doesn't change circuit already matching backend coupling
         """
         backend = FakeBackEnd()
-        qr = qiskit.QuantumRegister(16)
-        cr = qiskit.ClassicalRegister(16)
-        qc = qiskit.QuantumCircuit(qr, cr)
+        qr = QuantumRegister(16)
+        cr = ClassicalRegister(16)
+        qc = QuantumCircuit(qr, cr)
         qc.h(qr[1])
         qc.x(qr[2])
         qc.x(qr[3])
@@ -393,9 +395,9 @@ def test_compile_circuits_diff_registers(self):
         backend = FakeBackEnd()
         circuits = []
         for _ in range(2):
-            qr = qiskit.QuantumRegister(2)
-            cr = qiskit.ClassicalRegister(2)
-            circuit = qiskit.QuantumCircuit(qr, cr)
+            qr = QuantumRegister(2)
+            cr = ClassicalRegister(2)
+            circuit = QuantumCircuit(qr, cr)
             circuit.h(qr[0])
             circuit.cx(qr[0], qr[1])
             circuit.measure(qr, cr)
@@ -404,6 +406,128 @@ def test_compile_circuits_diff_registers(self):
         qobj = transpiler.compile(circuits, backend)
         self.assertIsInstance(qobj, Qobj)
 
+    def test_example_multiple_compile(self):
+        """Test a toy example compiling multiple circuits.
+
+        Pass if the results are correct.
+        """
+        backend = get_backend('local_qasm_simulator')
+        coupling_map = [[0, 1], [0, 2],
+                        [1, 2],
+                        [3, 2], [3, 4],
+                        [4, 2]]
+
+        q = QuantumRegister(5)
+        c = ClassicalRegister(5)
+        bell = QuantumCircuit(q, c)
+        ghz = QuantumCircuit(q, c)
+        # Create a GHZ state
+        ghz.h(q[0])
+        for i in range(4):
+            ghz.cx(q[i], q[i+1])
+        # Insert a barrier before measurement
+        ghz.barrier()
+        # Measure all of the qubits in the standard basis
+        for i in range(5):
+            ghz.measure(q[i], c[i])
+        # Create a Bell state
+        bell.h(q[0])
+        bell.cx(q[0], q[1])
+        bell.barrier()
+        bell.measure(q[0], c[0])
+        bell.measure(q[1], c[1])
+        shots = 2048
+        bell_qobj = compile(bell, backend='local_qasm_simulator',
+                            shots=shots, seed=10)
+        ghz_qobj = compile(ghz, backend='local_qasm_simulator',
+                           shots=shots, coupling_map=coupling_map,
+                           seed=10)
+        bell_result = backend.run(bell_qobj).result()
+        ghz_result = backend.run(ghz_qobj).result()
+
+        threshold = 0.04 * shots
+        counts_bell = bell_result.get_counts()
+        target_bell = {'00000': shots / 2, '00011': shots / 2}
+        self.assertDictAlmostEqual(counts_bell, target_bell, threshold)
+
+        counts_ghz = ghz_result.get_counts()
+        target_ghz = {'00000': shots / 2, '11111': shots / 2}
+        self.assertDictAlmostEqual(counts_ghz, target_ghz, threshold)
+
+    def test_compile_coupling_map(self):
+        """Test compile_coupling_map.
+        If all correct should return data with the same stats. The circuit may
+        be different.
+        """
+        backend = get_backend('local_qasm_simulator')
+
+        q = QuantumRegister(3, 'q')
+        c = ClassicalRegister(3, 'c')
+        qc = QuantumCircuit(q, c)
+        qc.h(q[0])
+        qc.cx(q[0], q[1])
+        qc.cx(q[0], q[2])
+        qc.measure(q[0], c[0])
+        qc.measure(q[1], c[1])
+        qc.measure(q[2], c[2])
+        shots = 1024
+        coupling_map = [[0, 1], [1, 2]]
+        initial_layout = {("q", 0): ("q", 0), ("q", 1): ("q", 1),
+                          ("q", 2): ("q", 2)}
+        qobj = compile(qc, backend=backend, shots=shots,
+                       coupling_map=coupling_map,
+                       initial_layout=initial_layout, seed=88)
+        job = backend.run(qobj)
+        result = job.result()
+        qasm_to_check = qc.qasm()
+        self.assertEqual(len(qasm_to_check), 160)
+
+        counts = result.get_counts(qc)
+        target = {'000': shots / 2, '111': shots / 2}
+        threshold = 0.04 * shots
+        self.assertDictAlmostEqual(counts, target, threshold)
+
+    def test_example_swap_bits(self):
+        """Test a toy example swapping a set bit around.
+
+        Uses the mapper. Pass if results are correct.
+        """
+        coupling_map = [[0, 1], [0, 8], [1, 2], [1, 9], [2, 3], [2, 10],
+                        [3, 4], [3, 11], [4, 5], [4, 12], [5, 6], [5, 13],
+                        [6, 7], [6, 14], [7, 15], [8, 9], [9, 10], [10, 11],
+                        [11, 12], [12, 13], [13, 14], [14, 15]]
+
+        n = 3  # make this at least 3
+        q = QuantumRegister(n)
+        r = QuantumRegister(n)
+        ans = ClassicalRegister(2*n)
+        qc = QuantumCircuit(q, r, ans)
+        # Set the first bit of q
+        qc.x(q[0])
+        # Swap the set bit
+        qc.swap(q[0], q[n-1])
+        qc.swap(q[n-1], r[n-1])
+        qc.swap(r[n-1], q[1])
+        qc.swap(q[1], r[1])
+        # Insert a barrier before measurement
+        qc.barrier()
+        # Measure all of the qubits in the standard basis
+        for j in range(n):
+            qc.measure(q[j], ans[j])
+            qc.measure(r[j], ans[j+n])
+        # First version: no mapping
+        result = execute(qc, backend='local_qasm_simulator',
+                         coupling_map=None, shots=1024,
+                         seed=14).result()
+        self.assertEqual(result.get_counts(qc),
+                         {'010000': 1024})
+        # Second version: map to coupling graph
+        result = execute(qc, backend='local_qasm_simulator',
+                         coupling_map=coupling_map, shots=1024,
+                         seed=14).result()
+        self.assertEqual(result.get_counts(qc),
+                         {'010000': 1024})
+
 
 if __name__ == '__main__':
     unittest.main(verbosity=2)
diff --git a/test/python/test_ibmq_qasm_simulator.py b/test/python/test_ibmq_qasm_simulator.py
new file mode 100644
--- /dev/null
+++ b/test/python/test_ibmq_qasm_simulator.py
@@ -0,0 +1,107 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2018, IBM.
+#
+# This source code is licensed under the Apache License, Version 2.0 found in
+# the LICENSE.txt file in the root directory of this source tree.
+
+# pylint: disable=invalid-name,missing-docstring,broad-except
+
+"""Test IBMQ online qasm simulator.
+TODO: Must expand tests. Re-evaluate after Aer."""
+
+from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegister
+from qiskit import transpiler
+from qiskit.backends.ibmq import IBMQProvider
+from .common import requires_qe_access, QiskitTestCase
+
+
+class TestIbmqQasmSimulator(QiskitTestCase):
+    """Test IBM Q Qasm Simulator."""
+
+    @requires_qe_access
+    def test_execute_one_circuit_simulator_online(self, qe_token, qe_url):
+        """Test execute_one_circuit_simulator_online.
+
+        If all correct should return correct counts.
+        """
+        provider = IBMQProvider(qe_token, qe_url)
+        backend = provider.get_backend('ibmq_qasm_simulator')
+        qr = QuantumRegister(1)
+        cr = ClassicalRegister(1)
+        qc = QuantumCircuit(qr, cr)
+        qc.h(qr[0])
+        qc.measure(qr[0], cr[0])
+        qobj = transpiler.compile(qc, backend, seed=73846087)
+        shots = qobj.config.shots
+        job = backend.run(qobj)
+        result = job.result()
+        counts = result.get_counts(qc)
+        target = {'0': shots / 2, '1': shots / 2}
+        threshold = 0.04 * shots
+        self.assertDictAlmostEqual(counts, target, threshold)
+
+    @requires_qe_access
+    def test_execute_several_circuits_simulator_online(self, qe_token, qe_url):
+        """Test execute_several_circuits_simulator_online.
+
+        If all correct should return correct counts.
+        """
+        provider = IBMQProvider(qe_token, qe_url)
+        backend = provider.get_backend('ibmq_qasm_simulator')
+        qr = QuantumRegister(2)
+        cr = ClassicalRegister(2)
+        qc1 = QuantumCircuit(qr, cr)
+        qc2 = QuantumCircuit(qr, cr)
+        qc1.h(qr)
+        qc2.h(qr[0])
+        qc2.cx(qr[0], qr[1])
+        qc1.measure(qr[0], cr[0])
+        qc1.measure(qr[1], cr[1])
+        qc2.measure(qr[0], cr[0])
+        qc2.measure(qr[1], cr[1])
+        shots = 1024
+        qobj = transpiler.compile([qc1, qc2], backend, seed=73846087, shots=shots)
+        job = backend.run(qobj)
+        result = job.result()
+        counts1 = result.get_counts(qc1)
+        counts2 = result.get_counts(qc2)
+        target1 = {'00': shots / 4, '01': shots / 4,
+                   '10': shots / 4, '11': shots / 4}
+        target2 = {'00': shots / 2, '11': shots / 2}
+        threshold = 0.04 * shots
+        self.assertDictAlmostEqual(counts1, target1, threshold)
+        self.assertDictAlmostEqual(counts2, target2, threshold)
+
+    @requires_qe_access
+    def test_online_qasm_simulator_two_registers(self, qe_token, qe_url):
+        """Test online_qasm_simulator_two_registers.
+
+        If all correct should return correct counts.
+        """
+        provider = IBMQProvider(qe_token, qe_url)
+        backend = provider.get_backend('ibmq_qasm_simulator')
+        q1 = QuantumRegister(2)
+        c1 = ClassicalRegister(2)
+        q2 = QuantumRegister(2)
+        c2 = ClassicalRegister(2)
+        qc1 = QuantumCircuit(q1, q2, c1, c2)
+        qc2 = QuantumCircuit(q1, q2, c1, c2)
+        qc1.x(q1[0])
+        qc2.x(q2[1])
+        qc1.measure(q1[0], c1[0])
+        qc1.measure(q1[1], c1[1])
+        qc1.measure(q2[0], c2[0])
+        qc1.measure(q2[1], c2[1])
+        qc2.measure(q1[0], c1[0])
+        qc2.measure(q1[1], c1[1])
+        qc2.measure(q2[0], c2[0])
+        qc2.measure(q2[1], c2[1])
+        shots = 1024
+        qobj = transpiler.compile([qc1, qc2], backend, seed=8458, shots=shots)
+        job = backend.run(qobj)
+        result = job.result()
+        result1 = result.get_counts(qc1)
+        result2 = result.get_counts(qc2)
+        self.assertEqual(result1, {'00 01': 1024})
+        self.assertEqual(result2, {'10 00': 1024})
diff --git a/test/python/test_identifiers.py b/test/python/test_identifiers.py
--- a/test/python/test_identifiers.py
+++ b/test/python/test_identifiers.py
@@ -5,301 +5,29 @@
 # This source code is licensed under the Apache License, Version 2.0 found in
 # the LICENSE.txt file in the root directory of this source tree.
 
-# pylint: disable=missing-docstring,broad-except
+# pylint: disable=invalid-name,missing-docstring,broad-except
 
 """Non-string identifiers for circuit and record identifiers test"""
 
 import unittest
 
-from qiskit import ClassicalRegister, QISKitError, QuantumCircuit, QuantumProgram, QuantumRegister
+from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegister
+from qiskit import QISKitError
 from qiskit import wrapper
-from qiskit.qobj import Qobj
-from .common import QiskitTestCase, requires_cpp_simulator
+from qiskit.backends.local.qasm_simulator_cpp import QasmSimulatorCpp
+from .common import QiskitTestCase
 
+# Cpp backend required
+try:
+    cpp_backend = QasmSimulatorCpp()
+except FileNotFoundError:
+    _skip_cpp = True
+else:
+    _skip_cpp = False
 
-class TestAnonymousIdsInQuantumProgram(QiskitTestCase):
-    """Circuits and records can have no name"""
 
-    def setUp(self):
-        self.qps_specs_nonames = {
-            "circuits": [{
-                "quantum_registers": [{
-                    "size": 3}],
-                "classical_registers": [{
-                    "size": 3}]
-            }]
-        }
-
-    ###############################################################
-    # Tests to initiate and build a quantum program with anonymous ids
-    ###############################################################
-
-    def test_create_program_with_specsnonames(self):
-        """Test Quantum Object Factory creation using Specs definition
-        object with no names for circuit nor records.
-        """
-        result = QuantumProgram(specs=self.qps_specs_nonames)
-        self.assertIsInstance(result, QuantumProgram)
-
-    def test_create_anonymous_classical_register(self):
-        """Test create_classical_register with no name.
-        """
-        q_program = QuantumProgram()
-        cr = q_program.create_classical_register(size=3)
-        self.assertIsInstance(cr, ClassicalRegister)
-
-    def test_create_anonymous_quantum_register(self):
-        """Test create_quantum_register with no name.
-        """
-        q_program = QuantumProgram()
-        qr = q_program.create_quantum_register(size=3)
-        self.assertIsInstance(qr, QuantumRegister)
-
-    def test_create_classical_registers_noname(self):
-        """Test create_classical_registers with no name
-        """
-        q_program = QuantumProgram()
-        classical_registers = [{"size": 4},
-                               {"size": 2}]
-        crs = q_program.create_classical_registers(classical_registers)
-        for i in crs:
-            self.assertIsInstance(i, ClassicalRegister)
-
-    def test_create_quantum_registers_noname(self):
-        """Test create_quantum_registers with no name.
-        """
-        q_program = QuantumProgram()
-        quantum_registers = [{"size": 4},
-                             {"size": 2}]
-        qrs = q_program.create_quantum_registers(quantum_registers)
-        for i in qrs:
-            self.assertIsInstance(i, QuantumRegister)
-
-    def test_create_circuit_noname(self):
-        """Test create_circuit with no name
-        """
-        q_program = QuantumProgram()
-        qr = q_program.create_quantum_register(size=3)
-        cr = q_program.create_classical_register(size=3)
-        qc = q_program.create_circuit(qregisters=[qr], cregisters=[cr])
-        self.assertIsInstance(qc, QuantumCircuit)
-
-    def test_create_several_circuits_noname(self):
-        """Test create_circuit with several inputs and without names.
-        """
-        q_program = QuantumProgram()
-        qr1 = q_program.create_quantum_register(size=3)
-        cr1 = q_program.create_classical_register(size=3)
-        qr2 = q_program.create_quantum_register(size=3)
-        cr2 = q_program.create_classical_register(size=3)
-        qc1 = q_program.create_circuit(qregisters=[qr1], cregisters=[cr1])
-        qc2 = q_program.create_circuit(qregisters=[qr2], cregisters=[cr2])
-        qc3 = q_program.create_circuit(qregisters=[qr1, qr2], cregisters=[cr1, cr2])
-        self.assertIsInstance(qc1, QuantumCircuit)
-        self.assertIsInstance(qc2, QuantumCircuit)
-        self.assertIsInstance(qc3, QuantumCircuit)
-
-    def test_get_register_and_circuit_names_nonames(self):
-        """Get the names of the circuits and registers after create them without a name
-        """
-        q_program = QuantumProgram()
-        qr1 = q_program.create_quantum_register(size=3)
-        cr1 = q_program.create_classical_register(size=3)
-        qr2 = q_program.create_quantum_register(size=3)
-        cr2 = q_program.create_classical_register(size=3)
-        q_program.create_circuit(qregisters=[qr1], cregisters=[cr1])
-        q_program.create_circuit(qregisters=[qr2], cregisters=[cr2])
-        q_program.create_circuit(qregisters=[qr1, qr2], cregisters=[cr1, cr2])
-        qrn = q_program.get_quantum_register_names()
-        crn = q_program.get_classical_register_names()
-        qcn = q_program.get_circuit_names()
-        self.assertEqual(len(qrn), 2)
-        self.assertEqual(len(crn), 2)
-        self.assertEqual(len(qcn), 3)
-
-    def test_get_circuit_noname(self):
-        q_program = QuantumProgram(specs=self.qps_specs_nonames)
-        qc = q_program.get_circuit()
-        self.assertIsInstance(qc, QuantumCircuit)
-
-    def test_get_quantum_register_noname(self):
-        q_program = QuantumProgram(specs=self.qps_specs_nonames)
-        qr = q_program.get_quantum_register()
-        self.assertIsInstance(qr, QuantumRegister)
-
-    def test_get_classical_register_noname(self):
-        q_program = QuantumProgram(specs=self.qps_specs_nonames)
-        cr = q_program.get_classical_register()
-        self.assertIsInstance(cr, ClassicalRegister)
-
-    def test_get_qasm_noname(self):
-        """Test the get_qasm using an specification without names.
-        """
-        q_program = QuantumProgram(specs=self.qps_specs_nonames)
-        qc = q_program.get_circuit()
-
-        qrn = list(q_program.get_quantum_register_names())
-        self.assertEqual(len(qrn), 1)
-        qr = q_program.get_quantum_register(qrn[0])
-
-        crn = list(q_program.get_classical_register_names())
-        self.assertEqual(len(crn), 1)
-        cr = q_program.get_classical_register(crn[0])
-
-        qc.h(qr[0])
-        qc.cx(qr[0], qr[1])
-        qc.cx(qr[1], qr[2])
-        qc.measure(qr[0], cr[0])
-        qc.measure(qr[1], cr[1])
-        qc.measure(qr[2], cr[2])
-        result = q_program.get_qasm()
-        self.assertEqual(len(result), len(qrn[0]) * 9 + len(crn[0]) * 4 + 147)
-
-    def test_get_qasms_noname(self):
-        """Test the get_qasms from a qprogram without names.
-        """
-        q_program = QuantumProgram()
-        qr = q_program.create_quantum_register(size=3)
-        cr = q_program.create_classical_register(size=3)
-        qc1 = q_program.create_circuit(qregisters=[qr], cregisters=[cr])
-        qc2 = q_program.create_circuit(qregisters=[qr], cregisters=[cr])
-        qc1.h(qr[0])
-        qc1.cx(qr[0], qr[1])
-        qc1.cx(qr[1], qr[2])
-        qc1.measure(qr[0], cr[0])
-        qc1.measure(qr[1], cr[1])
-        qc1.measure(qr[2], cr[2])
-        qc2.h(qr)
-        qc2.measure(qr[0], cr[0])
-        qc2.measure(qr[1], cr[1])
-        qc2.measure(qr[2], cr[2])
-        results = dict(zip(q_program.get_circuit_names(), q_program.get_qasms()))
-        qr_name_len = len(qr.name)
-        cr_name_len = len(cr.name)
-        self.assertEqual(len(results[qc1.name]), qr_name_len * 9 + cr_name_len * 4 + 147)
-        self.assertEqual(len(results[qc2.name]), qr_name_len * 7 + cr_name_len * 4 + 137)
-
-    def test_get_qasm_all_gates(self):
-        """Test the get_qasm for more gates, using an specification without names.
-        """
-        q_program = QuantumProgram(specs=self.qps_specs_nonames)
-        qc = q_program.get_circuit()
-        qr = q_program.get_quantum_register()
-        cr = q_program.get_classical_register()
-        qc.u1(0.3, qr[0])
-        qc.u2(0.2, 0.1, qr[1])
-        qc.u3(0.3, 0.2, 0.1, qr[2])
-        qc.s(qr[1])
-        qc.s(qr[2]).inverse()
-        qc.cx(qr[1], qr[2])
-        qc.barrier()
-        qc.cx(qr[0], qr[1])
-        qc.h(qr[0])
-        qc.x(qr[2]).c_if(cr, 0)
-        qc.y(qr[2]).c_if(cr, 1)
-        qc.z(qr[2]).c_if(cr, 2)
-        qc.barrier(qr)
-        qc.measure(qr[0], cr[0])
-        qc.measure(qr[1], cr[1])
-        qc.measure(qr[2], cr[2])
-        result = q_program.get_qasm()
-        self.assertEqual(len(result), (len(qr.name) * 23 +
-                                       len(cr.name) * 7 +
-                                       385))
-
-    ###############################################################
-    # Test for compile
-    ###############################################################
-
-    def test_compile_program_noname(self):
-        """Test compile with a no name.
-        """
-        q_program = QuantumProgram(specs=self.qps_specs_nonames)
-        qc = q_program.get_circuit()
-        qr = q_program.get_quantum_register()
-        cr = q_program.get_classical_register()
-        qc.h(qr[0])
-        qc.cx(qr[0], qr[1])
-        qc.measure(qr[0], cr[0])
-        qc.measure(qr[1], cr[1])
-        out = q_program.compile()
-        self.log.info(out)
-        self.assertIsInstance(out, Qobj)
-
-    def test_get_execution_list_noname(self):
-        """Test get_execution_list for circuits without name.
-        """
-        q_program = QuantumProgram(specs=self.qps_specs_nonames)
-        qc = q_program.get_circuit()
-        qr = q_program.get_quantum_register()
-        cr = q_program.get_classical_register()
-        qc.h(qr[0])
-        qc.cx(qr[0], qr[1])
-        qc.measure(qr[0], cr[0])
-        qc.measure(qr[1], cr[1])
-        qobj = q_program.compile()
-        result = q_program.get_execution_list(qobj, print_func=self.log.info)
-        self.assertEqual(len(result), 1)
-
-    def test_change_circuit_qobj_after_compile_noname(self):
-        q_program = QuantumProgram(specs=self.qps_specs_nonames)
-        qr = q_program.get_quantum_register()
-        cr = q_program.get_classical_register()
-        qc2 = q_program.create_circuit(qregisters=[qr], cregisters=[cr])
-        qc3 = q_program.create_circuit(qregisters=[qr], cregisters=[cr])
-        qc2.h(qr[0])
-        qc2.cx(qr[0], qr[1])
-        qc2.cx(qr[0], qr[2])
-        qc3.h(qr)
-        qc2.measure(qr, cr)
-        qc3.measure(qr, cr)
-        circuits = [qc2.name, qc3.name]
-        shots = 1024
-        backend = 'local_qasm_simulator'
-        config = {'seed': 10, 'shots': 1, 'xvals': [1, 2, 3, 4]}
-        qobj1 = q_program.compile(circuits, backend=backend, shots=shots, seed=88, config=config)
-        qobj1.experiments[0].config.shots = 50
-        qobj1.experiments[0].config.xvals = [1, 1, 1]
-        config['shots'] = 1000
-        config['xvals'][0] = 'only for qobj2'
-        qobj2 = q_program.compile(circuits, backend=backend, shots=shots, seed=88, config=config)
-        self.assertTrue(qobj1.experiments[0].config.shots == 50)
-        self.assertTrue(qobj1.experiments[1].config.shots == 1)
-        self.assertTrue(qobj1.experiments[0].config.xvals == [1, 1, 1])
-        self.assertTrue(qobj1.experiments[1].config.xvals == [1, 2, 3, 4])
-        self.assertTrue(qobj1.config.shots == 1024)
-        self.assertTrue(qobj2.experiments[0].config.shots == 1000)
-        self.assertTrue(qobj2.experiments[1].config.shots == 1000)
-        self.assertTrue(qobj2.experiments[0].config.xvals == [
-            'only for qobj2', 2, 3, 4])
-        self.assertTrue(qobj2.experiments[1].config.xvals == [
-            'only for qobj2', 2, 3, 4])
-
-    def test_add_circuit_noname(self):
-        """Test add two circuits without names. Also tests get_counts without circuit name.
-        """
-        q_program = QuantumProgram()
-        qr = q_program.create_quantum_register(size=2)
-        cr = q_program.create_classical_register(size=2)
-        qc1 = q_program.create_circuit(qregisters=[qr], cregisters=[cr])
-        qc2 = q_program.create_circuit(qregisters=[qr], cregisters=[cr])
-        qc1.h(qr[0])
-        qc1.measure(qr[0], cr[0])
-        qc2.measure(qr[1], cr[1])
-        new_circuit = qc1 + qc2
-        q_program.add_circuit(quantum_circuit=new_circuit)
-        backend = 'local_qasm_simulator_py'  # cpp simulator rejects non string IDs (FIXME)
-        shots = 1024
-        result = q_program.execute(backend=backend, shots=shots, seed=78)
-        counts = result.get_counts(new_circuit.name)
-        target = {'00': shots / 2, '01': shots / 2}
-        threshold = 0.04 * shots
-        self.assertDictAlmostEqual(counts, target, threshold)
-        self.assertRaises(QISKitError, result.get_counts)
-
-
-class TestQobj(QiskitTestCase):
-    """Check the objects compiled for different backends create names properly"""
+class TestQobjIdentifiers(QiskitTestCase):
+    """Check the Qobj compiled for different backends create names properly"""
 
     def setUp(self):
         qr = QuantumRegister(2, name="qr2")
@@ -314,44 +42,44 @@ def setUp(self):
     def test_local_qasm_simulator_py(self):
         backend = wrapper.get_backend('local_qasm_simulator_py')
         qobj = wrapper.compile(self.circuits, backend=backend)
-        compiled_circuit = qobj.experiments[0]
-        compiled_circuit_qasm = qobj.experiments[0].header.compiled_circuit_qasm
-        self.assertIn(self.qr_name, map(lambda x: x[0], compiled_circuit.header.qubit_labels))
-        self.assertIn(self.qr_name, compiled_circuit_qasm)
-        self.assertIn(self.cr_name, map(lambda x: x[0], compiled_circuit.header.clbit_labels))
-        self.assertIn(self.cr_name, compiled_circuit_qasm)
-
-    @requires_cpp_simulator
+        cc = qobj.experiments[0]
+        ccq = qobj.experiments[0].header.compiled_circuit_qasm
+        self.assertIn(self.qr_name, map(lambda x: x[0], cc.header.qubit_labels))
+        self.assertIn(self.qr_name, ccq)
+        self.assertIn(self.cr_name, map(lambda x: x[0], cc.header.clbit_labels))
+        self.assertIn(self.cr_name, ccq)
+
+    @unittest.skipIf(_skip_cpp, "no c++ simulator found.")
     def test_local_clifford_simulator_cpp(self):
         backend = wrapper.get_backend('local_clifford_simulator_cpp')
         qobj = wrapper.compile(self.circuits, backend=backend)
-        compiled_circuit = qobj.experiments[0]
-        compiled_circuit_qasm = qobj.experiments[0].header.compiled_circuit_qasm
-        self.assertIn(self.qr_name, map(lambda x: x[0], compiled_circuit.header.qubit_labels))
-        self.assertIn(self.qr_name, compiled_circuit_qasm)
-        self.assertIn(self.cr_name, map(lambda x: x[0], compiled_circuit.header.clbit_labels))
-        self.assertIn(self.cr_name, compiled_circuit_qasm)
-
-    @requires_cpp_simulator
+        cc = qobj.experiments[0]
+        ccq = qobj.experiments[0].header.compiled_circuit_qasm
+        self.assertIn(self.qr_name, map(lambda x: x[0], cc.header.qubit_labels))
+        self.assertIn(self.qr_name, ccq)
+        self.assertIn(self.cr_name, map(lambda x: x[0], cc.header.clbit_labels))
+        self.assertIn(self.cr_name, ccq)
+
+    @unittest.skipIf(_skip_cpp, "no c++ simulator found.")
     def test_local_qasm_simulator_cpp(self):
         backend = wrapper.get_backend('local_qasm_simulator_cpp')
         qobj = wrapper.compile(self.circuits, backend=backend)
-        compiled_circuit = qobj.experiments[0]
-        compiled_circuit_qasm = qobj.experiments[0].header.compiled_circuit_qasm
-        self.assertIn(self.qr_name, map(lambda x: x[0], compiled_circuit.header.qubit_labels))
-        self.assertIn(self.qr_name, compiled_circuit_qasm)
-        self.assertIn(self.cr_name, map(lambda x: x[0], compiled_circuit.header.clbit_labels))
-        self.assertIn(self.cr_name, compiled_circuit_qasm)
+        cc = qobj.experiments[0]
+        ccq = qobj.experiments[0].header.compiled_circuit_qasm
+        self.assertIn(self.qr_name, map(lambda x: x[0], cc.header.qubit_labels))
+        self.assertIn(self.qr_name, ccq)
+        self.assertIn(self.cr_name, map(lambda x: x[0], cc.header.clbit_labels))
+        self.assertIn(self.cr_name, ccq)
 
     def test_local_unitary_simulator(self):
         backend = wrapper.get_backend('local_unitary_simulator_py')
         qobj = wrapper.compile(self.circuits, backend=backend)
-        compiled_circuit = qobj.experiments[0]
-        compiled_circuit_qasm = qobj.experiments[0].header.compiled_circuit_qasm
-        self.assertIn(self.qr_name, map(lambda x: x[0], compiled_circuit.header.qubit_labels))
-        self.assertIn(self.qr_name, compiled_circuit_qasm)
-        self.assertIn(self.cr_name, map(lambda x: x[0], compiled_circuit.header.clbit_labels))
-        self.assertIn(self.cr_name, compiled_circuit_qasm)
+        cc = qobj.experiments[0]
+        ccq = qobj.experiments[0].header.compiled_circuit_qasm
+        self.assertIn(self.qr_name, map(lambda x: x[0], cc.header.qubit_labels))
+        self.assertIn(self.qr_name, ccq)
+        self.assertIn(self.cr_name, map(lambda x: x[0], cc.header.clbit_labels))
+        self.assertIn(self.cr_name, ccq)
 
 
 class TestAnonymousIds(QiskitTestCase):
@@ -359,33 +87,33 @@ class TestAnonymousIds(QiskitTestCase):
     """
 
     def test_create_anonymous_classical_register(self):
-        """Test creating a ClassicalRegister with no name.
+        """ClassicalRegister with no name.
         """
         cr = ClassicalRegister(size=3)
         self.assertIsInstance(cr, ClassicalRegister)
 
     def test_create_anonymous_quantum_register(self):
-        """Test creating a QuantumRegister with no name.
+        """QuantumRegister with no name.
         """
         qr = QuantumRegister(size=3)
         self.assertIsInstance(qr, QuantumRegister)
 
     def test_create_anonymous_classical_registers(self):
-        """Test creating several ClassicalRegister with no name.
+        """Several ClassicalRegister with no name.
         """
         cr1 = ClassicalRegister(size=3)
         cr2 = ClassicalRegister(size=3)
         self.assertNotEqual(cr1.name, cr2.name)
 
     def test_create_anonymous_quantum_registers(self):
-        """Test creating several QuantumRegister with no name.
+        """Several QuantumRegister with no name.
         """
         qr1 = QuantumRegister(size=3)
         qr2 = QuantumRegister(size=3)
         self.assertNotEqual(qr1.name, qr2.name)
 
     def test_create_anonymous_mixed_registers(self):
-        """Test creating several Registers with no name.
+        """Several Registers with no name.
         """
         cr0 = ClassicalRegister(size=3)
         qr0 = QuantumRegister(size=3)
@@ -404,7 +132,7 @@ def test_create_anonymous_mixed_registers(self):
         self.assertEqual(qr_current, qr_index + 2)
 
     def test_create_circuit_noname(self):
-        """Test create_circuit with no name
+        """Create_circuit with no name
         """
         qr = QuantumRegister(size=3)
         cr = ClassicalRegister(size=3)
@@ -416,102 +144,32 @@ class TestInvalidIds(QiskitTestCase):
     """Circuits and records with invalid IDs"""
 
     def test_invalid_type_circuit_name(self):
-        """Test QuantumCircuit() with invalid type name
+        """QuantumCircuit() with invalid type name
         """
         qr = QuantumRegister(size=3)
         cr = ClassicalRegister(size=3)
         self.assertRaises(QISKitError, QuantumCircuit, qr, cr, name=1)
 
     def test_invalid_type_qr_name(self):
-        """Test QuantumRegister() with an invalid type name.
+        """QuantumRegister() with an invalid type name.
         """
         self.assertRaises(QISKitError, QuantumRegister, size=3, name=1)
 
     def test_invalid_type_cr_name(self):
-        """Test ClassicalRegister() with an invalid type name.
+        """ClassicalRegister() with an invalid type name.
         """
         self.assertRaises(QISKitError, ClassicalRegister, size=3, name=1)
 
-    def test_invalid_type_qr_spec(self):
-        """qps_specs_nonames defines a quantum register with an invalid type name
-
-        Note: remove after QuantumProgram deprecation.
-        """
-        qps_specs_nonames = {
-            "circuits": [{
-                "quantum_registers": [{
-                    "name": 1,
-                    "size": 3}],
-                "classical_registers": [{
-                    "size": 3}]
-            }]
-        }
-
-        self.assertRaises(QISKitError, QuantumProgram, specs=qps_specs_nonames)
-
-    def test_invalid_type_cr_spec(self):
-        """qps_specs_nonames defines a classical register with an invalid type name
-
-        Note: remove after QuantumProgram deprecation.
-        """
-        qps_specs_nonames = {
-            "circuits": [{
-                "quantum_registers": [{
-                    "size": 3}],
-                "classical_registers": [{
-                    "name": 1,
-                    "size": 3}]
-            }]
-        }
-
-        self.assertRaises(QISKitError, QuantumProgram, specs=qps_specs_nonames)
-
     def test_invalid_qasmname_qr(self):
-        """Test QuantumRegister() with an invalid QASM name (do not start with lowercase).
+        """QuantumRegister() with invalid name.
         """
         self.assertRaises(QISKitError, QuantumRegister, size=3, name='Qr')
 
     def test_invalid_qasmname_cr(self):
-        """Test ClassicalRegister() with an invalid QASM name (do not start with lowercase).
+        """ClassicalRegister() with invalid name.
         """
         self.assertRaises(QISKitError, ClassicalRegister, size=3, name='Cr')
 
-    def test_invalid_qasmname_qr_spec(self):
-        """qps_specs_nonames defines a quantum register with invalid QASM name (do not start
-        with lowercase).
-
-        Note: remove after QuantumProgram deprecation.
-        """
-        qps_specs_nonames = {
-            "circuits": [{
-                "quantum_registers": [{
-                    "name": 'Qr',
-                    "size": 3}],
-                "classical_registers": [{
-                    "size": 3}]
-            }]
-        }
-
-        self.assertRaises(QISKitError, QuantumProgram, specs=qps_specs_nonames)
-
-    def test_invalid_qasmname_cr_spec(self):
-        """qps_specs_nonames defines a classical register with invalid QASM name (do not start
-        with lowercase).
-
-        Note: remove after QuantumProgram deprecation.
-        """
-        qps_specs_nonames = {
-            "circuits": [{
-                "quantum_registers": [{
-                    "size": 3}],
-                "classical_registers": [{
-                    "name": "Cr",
-                    "size": 3}]
-            }]
-        }
-
-        self.assertRaises(QISKitError, QuantumProgram, specs=qps_specs_nonames)
-
 
 if __name__ == '__main__':
     unittest.main(verbosity=2)
diff --git a/test/python/test_jsonoutput.py b/test/python/test_jsonoutput.py
deleted file mode 100644
--- a/test/python/test_jsonoutput.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2017, IBM.
-#
-# This source code is licensed under the Apache License, Version 2.0 found in
-# the LICENSE.txt file in the root directory of this source tree.
-
-# pylint: disable=missing-docstring
-
-"""Quick program to test json backend
-"""
-import unittest
-
-from qiskit import qasm, unroll, QuantumProgram
-
-from .common import QiskitTestCase, Path
-
-
-class TestJsonOutput(QiskitTestCase):
-    """Test Json output.
-
-    This is mostly covered in test_quantumprogram.py but will leave
-    here for convenience.
-    """
-    def setUp(self):
-        self.qasm_file_path = self._get_resource_path(
-            'qasm/entangled_registers.qasm', Path.EXAMPLES)
-
-    def test_json_output(self):
-        qprogram = QuantumProgram()
-        qprogram.load_qasm_file(self.qasm_file_path, name="example")
-
-        basis_gates = []  # unroll to base gates, change to test
-        unroller = unroll.Unroller(qasm.Qasm(data=qprogram.get_qasm("example")).parse(),
-                                   unroll.JsonBackend(basis_gates))
-        circuit = unroller.execute()
-        self.log.info('test_json_ouptut: %s', circuit)
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/test/python/test_load_qasm.py b/test/python/test_load_qasm.py
--- a/test/python/test_load_qasm.py
+++ b/test/python/test_load_qasm.py
@@ -15,7 +15,8 @@
 # limitations under the License.
 # =============================================================================
 
-# pylint: disable=missing-docstring
+
+"""Test cases for the load_qasm_file and load_qasm_string method."""
 
 from qiskit import QISKitError
 from qiskit.wrapper import load_qasm_file, load_qasm_string
@@ -34,10 +35,6 @@ def test_load_qasm_file(self):
         """Test load_qasm_file and get_circuit.
 
         If all is correct we should get the qasm file loaded in _qasm_file_path
-
-        Previously:
-            Libraries:
-                from qiskit.wrapper import load_qasm_file
         """
         q_circuit = load_qasm_file(self.qasm_file_path)
         qasm_string = q_circuit.qasm()
@@ -74,11 +71,6 @@ def test_fail_load_qasm_file(self):
         """Test fail_load_qasm_file.
 
         If all is correct we should get a QISKitError
-
-        Previously:
-            Libraries:
-                from qiskit import QISKitError
-                from qiskit.wrapper import load_qasm_file
         """
         self.assertRaises(QISKitError,
                           load_qasm_file, "", name=None)
@@ -87,11 +79,6 @@ def test_fail_load_qasm_string(self):
         """Test fail_load_qasm_string.
 
         If all is correct we should get a QISKitError
-
-        Previously:
-            Libraries:
-                from qiskit import QISKitError
-                from qiskit.wrapper import load_qasm_string
         """
         self.assertRaises(QISKitError,
                           load_qasm_string, "", name=None)
@@ -100,10 +87,6 @@ def test_load_qasm_text(self):
         """Test load_qasm_text and get_circuit.
 
         If all is correct we should get the qasm file loaded from the string
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
         """
         qasm_string = "// A simple 8 qubit example\nOPENQASM 2.0;\n"
         qasm_string += "include \"qelib1.inc\";\nqreg a[4];\n"
diff --git a/test/python/test_mapper.py b/test/python/test_mapper.py
--- a/test/python/test_mapper.py
+++ b/test/python/test_mapper.py
@@ -10,7 +10,7 @@
 import unittest
 
 import qiskit.wrapper
-from qiskit import (QuantumProgram, load_qasm_string, mapper, qasm, unroll)
+from qiskit import load_qasm_string, mapper, qasm, unroll
 from qiskit.qobj import Qobj
 from qiskit.transpiler._transpiler import transpile
 from qiskit.dagcircuit._dagcircuit import DAGCircuit
@@ -48,50 +48,48 @@ class MapperTest(QiskitTestCase):
 
     def setUp(self):
         self.seed = 42
-        self.qprogram = QuantumProgram()
 
     def test_mapper_overoptimization(self):
-        """
+        """Check mapper overoptimization
+
         The mapper should not change the semantics of the input. An overoptimization introduced
         the issue #81: https://github.com/QISKit/qiskit-terra/issues/81
         """
-        self.qprogram.load_qasm_file(
-            self._get_resource_path('qasm/overoptimization.qasm'), name='test')
+        circ = qiskit.load_qasm_file(self._get_resource_path('qasm/overoptimization.qasm'))
         coupling_map = [[0, 2], [1, 2], [2, 3]]
-        result1 = self.qprogram.execute(["test"], backend="local_qasm_simulator",
-                                        coupling_map=coupling_map)
-        count1 = result1.get_counts("test")
-        result2 = self.qprogram.execute(["test"], backend="local_qasm_simulator", coupling_map=None)
-        count2 = result2.get_counts("test")
+        result1 = qiskit.execute(circ, backend="local_qasm_simulator",
+                                 coupling_map=coupling_map, seed=self.seed)
+        count1 = result1.result().get_counts()
+        result2 = qiskit.execute(circ, backend="local_qasm_simulator", coupling_map=None,
+                                 seed=self.seed)
+        count2 = result2.result().get_counts()
         self.assertEqual(count1.keys(), count2.keys(), )
 
     def test_math_domain_error(self):
-        """
+        """Check for floating point errors.
+
         The math library operates over floats and introduce floating point errors that should be
         avoided.
         See: https://github.com/QISKit/qiskit-terra/issues/111
         """
-        self.qprogram.load_qasm_file(self._get_resource_path('qasm/math_domain_error.qasm'),
-                                     name='test')
+        circ = qiskit.load_qasm_file(self._get_resource_path('qasm/math_domain_error.qasm'))
         coupling_map = [[0, 2], [1, 2], [2, 3]]
         shots = 2000
-        result = self.qprogram.execute("test", backend="local_qasm_simulator",
-                                       coupling_map=coupling_map,
-                                       seed=self.seed, shots=shots)
-        counts = result.get_counts("test")
+        qobj = qiskit.execute(circ, backend="local_qasm_simulator",
+                              coupling_map=coupling_map,
+                              seed=self.seed, shots=shots)
+        counts = qobj.result().get_counts()
         target = {'0001': shots / 2, '0101':  shots / 2}
         threshold = 0.04 * shots
         self.assertDictAlmostEqual(counts, target, threshold)
 
     def test_optimize_1q_gates_issue159(self):
-        """Test change in behavior for optimize_1q_gates that removes u1(2*pi) rotations.
-
+        """optimize_1q_gates that removes u1(2*pi) rotations.
         See: https://github.com/QISKit/qiskit-terra/issues/159
         """
-        self.qprogram = QuantumProgram()
-        qr = self.qprogram.create_quantum_register('qr', 2)
-        cr = self.qprogram.create_classical_register('cr', 2)
-        qc = self.qprogram.create_circuit('Bell', [qr], [cr])
+        qr = qiskit.QuantumRegister(2, 'qr')
+        cr = qiskit.ClassicalRegister(2, 'cr')
+        qc = qiskit.QuantumCircuit(qr, cr)
         qc.h(qr[0])
         qc.cx(qr[1], qr[0])
         qc.cx(qr[1], qr[0])
@@ -101,19 +99,23 @@ def test_optimize_1q_gates_issue159(self):
         backend = 'local_qasm_simulator'
         coupling_map = [[1, 0], [2, 0], [2, 1], [2, 4], [3, 2], [3, 4]]
         initial_layout = {('qr', 0): ('q', 1), ('qr', 1): ('q', 0)}
-        qobj = self.qprogram.compile(["Bell"], backend=backend,
-                                     initial_layout=initial_layout, coupling_map=coupling_map)
+        qobj = qiskit.compile(qc, backend=backend,
+                              initial_layout=initial_layout,
+                              coupling_map=coupling_map)
+
+        comp_qasm = qobj.experiments[0].header.compiled_circuit_qasm
 
-        self.assertEqual(self.qprogram.get_compiled_qasm(qobj, "Bell"), EXPECTED_QASM_1Q_GATES_3_5)
+        self.assertEqual(comp_qasm, EXPECTED_QASM_1Q_GATES_3_5)
 
     def test_random_parameter_circuit(self):
         """Run a circuit with randomly generated parameters."""
-        self.qprogram.load_qasm_file(self._get_resource_path('qasm/random_n5_d5.qasm'), name='rand')
+        circ = qiskit.load_qasm_file(self._get_resource_path('qasm/random_n5_d5.qasm'))
         coupling_map = [[0, 1], [1, 2], [2, 3], [3, 4]]
         shots = 1024
-        result1 = self.qprogram.execute(["rand"], backend="local_qasm_simulator",
-                                        coupling_map=coupling_map, shots=shots, seed=self.seed)
-        counts = result1.get_counts("rand")
+        qobj = qiskit.execute(circ, backend="local_qasm_simulator",
+                              coupling_map=coupling_map, shots=shots,
+                              seed=self.seed)
+        counts = qobj.result().get_counts()
         expected_probs = {
             '00000': 0.079239867254200971,
             '00001': 0.032859032998526903,
@@ -153,7 +155,7 @@ def test_random_parameter_circuit(self):
         self.assertDictAlmostEqual(counts, target, threshold)
 
     def test_symbolic_unary(self):
-        """Test symbolic math in DAGBackend and optimizer with a prefix.
+        """SymPy with a prefix.
 
         See: https://github.com/QISKit/qiskit-terra/issues/172
         """
@@ -165,7 +167,7 @@ def test_symbolic_unary(self):
         self.assertEqual(circ.qasm(qeflag=True), EXPECTED_QASM_SYMBOLIC_UNARY)
 
     def test_symbolic_binary(self):
-        """Test symbolic math in DAGBackend and optimizer with a binary operation.
+        """SymPy binary operation.
 
         See: https://github.com/QISKit/qiskit-terra/issues/172
         """
@@ -178,7 +180,7 @@ def test_symbolic_binary(self):
         self.assertEqual(circ.qasm(qeflag=True), EXPECTED_QASM_SYMBOLIC_BINARY)
 
     def test_symbolic_extern(self):
-        """Test symbolic math in DAGBackend and optimizer with an external function.
+        """SymPy with external function.
 
         See: https://github.com/QISKit/qiskit-terra/issues/172
         """
@@ -190,7 +192,7 @@ def test_symbolic_extern(self):
         self.assertEqual(circ.qasm(qeflag=True), EXPECTED_QASM_SYMBOLIC_EXTERN)
 
     def test_symbolic_power(self):
-        """Test symbolic math in DAGBackend and optimizer with a power (^).
+        """SymPy with a power (^).
 
         See: https://github.com/QISKit/qiskit-terra/issues/172
         """
@@ -201,14 +203,13 @@ def test_symbolic_power(self):
         self.assertEqual(circ.qasm(qeflag=True), EXPECTED_QASM_SYMBOLIC_POWER)
 
     def test_already_mapped(self):
-        """Test that if the circuit already matches the backend topology, it is not remapped.
+        """Circuit not remapped if matches topology.
 
         See: https://github.com/QISKit/qiskit-terra/issues/342
         """
-        self.qprogram = QuantumProgram()
-        qr = self.qprogram.create_quantum_register('qr', 16)
-        cr = self.qprogram.create_classical_register('cr', 16)
-        qc = self.qprogram.create_circuit('native_cx', [qr], [cr])
+        qr = qiskit.QuantumRegister(16, 'qr')
+        cr = qiskit.ClassicalRegister(16, 'cr')
+        qc = qiskit.QuantumCircuit(qr, cr)
         qc.cx(qr[3], qr[14])
         qc.cx(qr[5], qr[4])
         qc.h(qr[9])
@@ -224,7 +225,7 @@ def test_already_mapped(self):
                         [6, 5], [6, 7], [6, 11], [7, 10], [8, 7], [9, 8],
                         [9, 10], [11, 10], [12, 5], [12, 11], [12, 13],
                         [13, 4], [13, 14], [15, 0], [15, 2], [15, 14]]
-        qobj = self.qprogram.compile(["native_cx"], backend=backend, coupling_map=coupling_map)
+        qobj = qiskit.compile(qc, backend=backend, coupling_map=coupling_map)
         cx_qubits = [x.qubits
                      for x in qobj.experiments[0].instructions
                      if x.name == "cx"]
@@ -232,7 +233,7 @@ def test_already_mapped(self):
         self.assertEqual(sorted(cx_qubits), [[3, 4], [3, 14], [5, 4], [9, 8], [12, 11], [13, 4]])
 
     def test_yzy_zyz_cases(self):
-        """Test mapper function yzy_to_zyz works in previously failed cases.
+        """yzy_to_zyz works in previously failed cases.
 
         See: https://github.com/QISKit/qiskit-terra/issues/607
         """
diff --git a/test/python/test_qasm_simulator_cpp.py b/test/python/test_qasm_simulator_cpp.py
--- a/test/python/test_qasm_simulator_cpp.py
+++ b/test/python/test_qasm_simulator_cpp.py
@@ -13,10 +13,8 @@
 import numpy as np
 from numpy.linalg import norm
 
-import qiskit
-from qiskit import ClassicalRegister
-from qiskit import QuantumCircuit
-from qiskit import QuantumRegister
+from qiskit import qasm, unroll
+from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
 from qiskit.backends.local.qasm_simulator_cpp import (QasmSimulatorCpp,
                                                       cx_error_matrix,
                                                       x90_error_matrix)
@@ -37,9 +35,9 @@ def setUp(self):
         self.qasm_filename = self._get_resource_path('qasm/example.qasm')
         with open(self.qasm_filename, 'r') as qasm_file:
             self.qasm_text = qasm_file.read()
-            self.qasm_ast = qiskit.qasm.Qasm(data=self.qasm_text).parse()
-            self.qasm_be = qiskit.unroll.CircuitBackend(['u1', 'u2', 'u3', 'id', 'cx'])
-            self.qasm_circ = qiskit.unroll.Unroller(self.qasm_ast, self.qasm_be).execute()
+            self.qasm_ast = qasm.Qasm(data=self.qasm_text).parse()
+            self.qasm_be = unroll.CircuitBackend(['u1', 'u2', 'u3', 'id', 'cx'])
+            self.qasm_circ = unroll.Unroller(self.qasm_ast, self.qasm_be).execute()
         qr = QuantumRegister(2, 'q')
         cr = ClassicalRegister(2, 'c')
         qc = QuantumCircuit(qr, cr)
diff --git a/test/python/test_qasm_simulator_py.py b/test/python/test_qasm_simulator_py.py
--- a/test/python/test_qasm_simulator_py.py
+++ b/test/python/test_qasm_simulator_py.py
@@ -5,45 +5,24 @@
 # This source code is licensed under the Apache License, Version 2.0 found in
 # the LICENSE.txt file in the root directory of this source tree.
 
-# pylint: disable=missing-docstring
+# pylint: disable=missing-docstring,redefined-builtin
 from sys import version_info
-import cProfile
-import io
-import pstats
-import shutil
-import time
 import unittest
 
-from matplotlib.backends.backend_pdf import PdfPages
 import numpy as np
-from qiskit import (qasm, unroll, transpiler,
-                    ClassicalRegister, QuantumRegister, QuantumCircuit)
+from qiskit import qasm, unroll
+from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit
+from qiskit import compile
 from qiskit.backends.local.qasm_simulator_py import QasmSimulatorPy
 from qiskit.qobj import Qobj, QobjHeader, QobjItem, QobjConfig, QobjExperiment
 
-from ._random_qasm_generator import RandomQasmGenerator
 from .common import QiskitTestCase
 
 
-DO_PROFILING = False
-
-
 class TestLocalQasmSimulatorPy(QiskitTestCase):
     """Test local_qasm_simulator_py."""
 
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        if DO_PROFILING:
-            cls.pdf = PdfPages(cls.moduleName + '.pdf')
-
-    @classmethod
-    def tearDownClass(cls):
-        if DO_PROFILING:
-            cls.pdf.close()
-
     def setUp(self):
-        self.qprogram = None
         self.seed = 88
         qasm_filename = self._get_resource_path('qasm/example.qasm')
         unroller = unroll.Unroller(qasm.Qasm(filename=qasm_filename).parse(),
@@ -172,8 +151,7 @@ def test_teleport(self):
         circuit.x(qr[2]).c_if(cr1, 1)
         circuit.measure(qr[2], cr2[0])
         backend = QasmSimulatorPy()
-        qobj = transpiler.compile(circuit, backend=backend, shots=shots,
-                                  seed=self.seed)
+        qobj = compile(circuit, backend=backend, shots=shots, seed=self.seed)
         results = backend.run(qobj).result()
         data = results.get_counts('teleport')
         alice = {
@@ -198,204 +176,6 @@ def test_teleport(self):
         self.log.info('test_teleport: relative error = %s', error)
         self.assertLess(error, 0.05)
 
-    @unittest.skipIf(not DO_PROFILING, "skipping simulator profiling.")
-    def profile_qasm_simulator(self):
-        """Profile randomly generated circuits.
-
-        Writes profile results to <this_module>.prof as well as recording
-        to the log file.
-
-        number of circuits = 100.
-        number of operations/circuit in [1, 40]
-        number of qubits in [1, 5]
-        """
-        seed = 88
-        shots = 1024
-        n_circuits = 100
-        min_depth = 1
-        max_depth = 40
-        min_qubits = 1
-        max_qubits = 5
-        profile = cProfile.Profile()
-        random_circuits = RandomQasmGenerator(seed,
-                                              min_qubits=min_qubits,
-                                              max_qubits=max_qubits,
-                                              min_depth=min_depth,
-                                              max_depth=max_depth)
-        random_circuits.add_circuits(n_circuits)
-        self.qprogram = random_circuits.get_program()
-        profile.enable()
-        self.qprogram.execute(self.qprogram.get_circuit_names(),
-                              backend='local_qasm_simulator_py',
-                              shots=shots)
-        profile.disable()
-        sout = io.StringIO()
-        stats = pstats.Stats(profile, stream=sout).sort_stats('cumulative')
-        self.log.info('------- start profiling QasmSimulatorPy -----------')
-        stats.print_stats()
-        self.log.info(sout.getvalue())
-        self.log.info('------- stop profiling QasmSimulatorPy -----------')
-        sout.close()
-        profile.dump_stats(self.moduleName + '.prof')
-
-    @unittest.skipIf(not DO_PROFILING, "skipping simulator profiling.")
-    def profile_nqubit_speed_grow_depth(self):
-        """simulation time vs the number of qubits
-
-        where the circuit depth is 10x the number of simulated
-        qubits. Also creates a pdf file with this module name showing a
-        plot of the results. Compilation is not included in speed.
-        """
-        import matplotlib.pyplot as plt
-        from matplotlib.ticker import MaxNLocator
-        qubit_range_max = 15
-        n_qubit_list = range(1, qubit_range_max + 1)
-        n_circuits = 10
-        shots = 1024
-        seed = 88
-        max_time = 30  # seconds; timing stops when simulation time exceeds this number
-        fmt_str1 = 'profile_nqubit_speed::nqubits:{0}, backend:{1}, elapsed_time:{2:.2f}'
-        fmt_str2 = 'backend:{0}, circuit:{1}, numOps:{2}, result:{3}'
-        fmt_str3 = 'minDepth={minDepth}, maxDepth={maxDepth}, num circuits={nCircuits},' \
-                   'shots={shots}'
-        backend_list = ['local_qasm_simulator_py', 'local_unitary_simulator_py']
-        if shutil.which('qasm_simulator'):
-            backend_list.append('local_qasm_simulator_cpp')
-        else:
-            self.log.info('profile_nqubit_speed::\"qasm_simulator\" executable'
-                          'not in path...skipping')
-        fig = plt.figure(0)
-        plt.clf()
-        axes = fig.add_axes((0.1, 0.25, 0.8, 0.6))
-        for _, backend in enumerate(backend_list):
-            elapsed_time = np.zeros(len(n_qubit_list))
-            if backend == 'local_unitary_simulator_py':
-                do_measure = False
-            else:
-                do_measure = True
-            j, timed_out = 0, False
-            while j < qubit_range_max and not timed_out:
-                n_qubits = n_qubit_list[j]
-                random_circuits = RandomQasmGenerator(seed,
-                                                      min_qubits=n_qubits,
-                                                      max_qubits=n_qubits,
-                                                      min_depth=n_qubits * 10,
-                                                      max_depth=n_qubits * 10)
-                random_circuits.add_circuits(n_circuits, do_measure=do_measure)
-                program = random_circuits.get_program()
-                c_names = program.get_circuit_names()
-                qobj = program.compile(c_names, backend=backend, shots=shots,
-                                       seed=seed)
-                start = time.perf_counter()
-                results = program.run(qobj)
-                stop = time.perf_counter()
-                elapsed_time[j] = stop - start
-                if elapsed_time[j] > max_time:
-                    timed_out = True
-                self.log.info(fmt_str1.format(n_qubits, backend, elapsed_time[j]))
-                if backend != 'local_unitary_simulator_py':
-                    for name in c_names:
-                        log_str = fmt_str2.format(
-                            backend, name, len(program.get_circuit(name)),
-                            results.get_data(name))
-                        self.log.info(log_str)
-                j += 1
-            axes.xaxis.set_major_locator(MaxNLocator(integer=True))
-            if backend == 'local_unitary_simulator_py':
-                axes.plot(n_qubit_list[:j], elapsed_time[:j], label=backend, marker='o')
-            else:
-                axes.plot(n_qubit_list[:j], elapsed_time[:j]/shots, label=backend,
-                          marker='o')
-            axes.set_yscale('log', basey=10)
-            axes.set_xlabel('number of qubits')
-            axes.set_ylabel('process time/shot')
-            axes.set_title('profile_nqubit_speed_grow_depth')
-            fig.text(0.1, 0.05,
-                     fmt_str3.format(minDepth='10*nQubits', maxDepth='10*nQubits',
-                                     nCircuits=n_circuits, shots=shots))
-            axes.legend()
-        self.pdf.savefig(fig)
-
-    @unittest.skipIf(not DO_PROFILING, "skipping simulator profiling.")
-    def profile_nqubit_speed_constant_depth(self):
-        """simulation time vs the number of qubits
-
-        where the circuit depth is fixed at 40. Also creates a pdf file
-        with this module name showing a plot of the results. Compilation
-        is not included in speed.
-        """
-        import matplotlib.pyplot as plt
-        from matplotlib.ticker import MaxNLocator
-        qubit_range_max = 15
-        n_qubit_list = range(1, qubit_range_max + 1)
-        max_depth = 40
-        min_depth = 40
-        n_circuits = 10
-        shots = 1024
-        seed = 88
-        max_time = 30  # seconds; timing stops when simulation time exceeds this number
-        fmt_str1 = 'profile_nqubit_speed::nqubits:{0}, backend:{1},' \
-                   'elapsed_time:{2:.2f}'
-        fmt_str2 = 'backend:{0}, circuit:{1}, numOps:{2}, result:{3}'
-        fmt_str3 = 'minDepth={minDepth}, maxDepth={maxDepth},' \
-                   'num circuits={nCircuits}, shots={shots}'
-        backend_list = ['local_qasm_simulator_py', 'local_unitary_simulator_py']
-        if shutil.which('qasm_simulator'):
-            backend_list.append('local_qasm_simulator_cpp')
-        else:
-            self.log.info('profile_nqubit_speed::\"qasm_simulator\" executable'
-                          'not in path...skipping')
-        fig = plt.figure(0)
-        plt.clf()
-        axes = fig.add_axes((0.1, 0.2, 0.8, 0.6))
-        for _, backend in enumerate(backend_list):
-            elapsed_time = np.zeros(len(n_qubit_list))
-            if backend == 'local_unitary_simulator_py':
-                do_measure = False
-            else:
-                do_measure = True
-            j, timed_out = 0, False
-            while j < qubit_range_max and not timed_out:
-                n_qubits = n_qubit_list[j]
-                random_circuits = RandomQasmGenerator(seed,
-                                                      min_qubits=n_qubits,
-                                                      max_qubits=n_qubits,
-                                                      min_depth=min_depth,
-                                                      max_depth=max_depth)
-                random_circuits.add_circuits(n_circuits, do_measure=do_measure)
-                qprogram = random_circuits.get_program()
-                cnames = qprogram.get_circuit_names()
-                qobj = qprogram.compile(cnames, backend=backend, shots=shots, seed=seed)
-                start = time.perf_counter()
-                results = qprogram.run(qobj)
-                stop = time.perf_counter()
-                elapsed_time[j] = stop - start
-                if elapsed_time[j] > max_time:
-                    timed_out = True
-                self.log.info(fmt_str1.format(n_qubits, backend, elapsed_time[j]))
-                if backend != 'local_unitary_simulator_py':
-                    for name in cnames:
-                        log_str = fmt_str2.format(
-                            backend, name, len(qprogram.get_circuit(name)),
-                            results.get_data(name))
-                        self.log.info(log_str)
-                j += 1
-            axes.xaxis.set_major_locator(MaxNLocator(integer=True))
-            if backend == 'local_unitary_simulator_py':
-                axes.plot(n_qubit_list[:j], elapsed_time[:j], label=backend, marker='o')
-            else:
-                axes.plot(n_qubit_list[:j], elapsed_time[:j]/shots, label=backend,
-                          marker='o')
-            axes.set_yscale('log', basey=10)
-            axes.set_xlabel('number of qubits')
-            axes.set_ylabel('process time/shot')
-            axes.set_title('profile_nqubit_speed_constant_depth')
-            fig.text(0.1, 0.05,
-                     fmt_str3.format(minDepth=min_depth, maxDepth=max_depth,
-                                     nCircuits=n_circuits, shots=shots))
-            axes.legend()
-        self.pdf.savefig(fig)
-
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/test/python/test_qobj.py b/test/python/test_qobj.py
--- a/test/python/test_qobj.py
+++ b/test/python/test_qobj.py
@@ -5,10 +5,14 @@
 # This source code is licensed under the Apache License, Version 2.0 found in
 # the LICENSE.txt file in the root directory of this source tree.
 
+# pylint: disable=redefined-builtin
+
 """QOBj test."""
 import unittest
 import json
 import jsonschema
+from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
+from qiskit import compile
 from qiskit.qobj import (Qobj, QobjConfig, QobjExperiment, QobjInstruction)
 from .common import QiskitTestCase, Path
 
@@ -87,3 +91,35 @@ def test_from_dict_per_class(self):
         for qobj_class, (qobj, expected_dict) in test_parameters.items():
             with self.subTest(msg=str(qobj_class)):
                 self.assertEqual(qobj, qobj_class.from_dict(expected_dict))
+
+    def test_change_qobj_after_compile(self):
+        """Test modifying Qobj parameters after compile."""
+        qr = QuantumRegister(3)
+        cr = ClassicalRegister(3)
+        qc1 = QuantumCircuit(qr, cr)
+        qc2 = QuantumCircuit(qr, cr)
+        qc1.h(qr[0])
+        qc1.cx(qr[0], qr[1])
+        qc1.cx(qr[0], qr[2])
+        qc2.h(qr)
+        qc1.measure(qr, cr)
+        qc2.measure(qr, cr)
+        circuits = [qc1, qc2]
+        shots = 1024
+        backend = 'local_qasm_simulator'
+        config = {'seed': 10, 'shots': 1, 'xvals': [1, 2, 3, 4]}
+        qobj1 = compile(circuits, backend=backend, shots=shots, seed=88, config=config)
+        qobj1.experiments[0].config.shots = 50
+        qobj1.experiments[0].config.xvals = [1, 1, 1]
+        config['shots'] = 1000
+        config['xvals'][0] = 'only for qobj2'
+        qobj2 = compile(circuits, backend=backend, shots=shots, seed=88, config=config)
+        self.assertTrue(qobj1.experiments[0].config.shots == 50)
+        self.assertTrue(qobj1.experiments[1].config.shots == 1)
+        self.assertTrue(qobj1.experiments[0].config.xvals == [1, 1, 1])
+        self.assertTrue(qobj1.experiments[1].config.xvals == [1, 2, 3, 4])
+        self.assertTrue(qobj1.config.shots == 1024)
+        self.assertTrue(qobj2.experiments[0].config.shots == 1000)
+        self.assertTrue(qobj2.experiments[1].config.shots == 1000)
+        self.assertTrue(qobj2.experiments[0].config.xvals == ['only for qobj2', 2, 3, 4])
+        self.assertTrue(qobj2.experiments[1].config.xvals == ['only for qobj2', 2, 3, 4])
diff --git a/test/python/test_quantumprogram.py b/test/python/test_quantumprogram.py
deleted file mode 100644
--- a/test/python/test_quantumprogram.py
+++ /dev/null
@@ -1,1626 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2017, IBM.
-#
-# This source code is licensed under the Apache License, Version 2.0 found in
-# the LICENSE.txt file in the root directory of this source tree.
-
-# pylint: disable=invalid-name,missing-docstring,broad-except
-
-"""Quantum Program QISKit Test."""
-
-import os
-import unittest
-from sys import version_info
-
-import numpy as np
-
-from qiskit import (ClassicalRegister, QISKitError, QuantumCircuit,
-                    QuantumRegister, QuantumProgram, Result)
-from qiskit.qobj import Qobj
-from qiskit.tools import file_io
-from .common import requires_qe_access, QiskitTestCase, Path
-
-
-class TestQuantumProgram(QiskitTestCase):
-    """QISKit QuantumProgram Object Tests."""
-
-    def setUp(self):
-        self.qasm_file_path = self._get_resource_path(
-            'qasm/entangled_registers.qasm', Path.EXAMPLES)
-        self.qasm_file_path_2 = self._get_resource_path(
-            'qasm/plaquette_check.qasm', Path.EXAMPLES)
-
-        self.QPS_SPECS = {
-            "circuits": [{
-                "name": "circuitName",
-                "quantum_registers": [{
-                    "name": "q_name",
-                    "size": 3}],
-                "classical_registers": [{
-                    "name": "c_name",
-                    "size": 3}]
-            }]
-        }
-
-    ###############################################################
-    # Tests to initiate an build a quantum program
-    ###############################################################
-
-    def test_create_program_with_specs(self):
-        """Test Quantum Object Factory creation using Specs definition object.
-
-        If all is correct we get a object instance of QuantumProgram
-
-        Previously:
-            Objects:
-                QPS_SPECS
-            Libraries:
-                from qiskit import QuantumProgram
-
-        """
-        result = QuantumProgram(specs=self.QPS_SPECS)
-        self.assertIsInstance(result, QuantumProgram)
-
-    def test_create_program(self):
-        """Test Quantum Object Factory creation Without Specs definition object.
-
-        If all is correct we get a object instance of QuantumProgram
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-        """
-        result = QuantumProgram()
-        self.assertIsInstance(result, QuantumProgram)
-
-    def test_create_classical_register(self):
-        """Test create_classical_register.
-
-        If all is correct we get a object instance of ClassicalRegister
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-                from qiskit import ClassicalRegister
-        """
-        q_program = QuantumProgram()
-        cr = q_program.create_classical_register("cr", 3)
-        self.assertIsInstance(cr, ClassicalRegister)
-
-    def test_create_quantum_register(self):
-        """Test create_quantum_register.
-
-        If all is correct we get a object instance of QuantumRegister
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-                from qiskit import QuantumRegister
-        """
-        q_program = QuantumProgram()
-        qr = q_program.create_quantum_register("qr", 3)
-        self.assertIsInstance(qr, QuantumRegister)
-
-    def test_fail_create_quantum_register(self):
-        """Test create_quantum_register.
-
-        If all is correct we get a object instance of QuantumRegister and
-        QISKitError
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-                from qiskit import QuantumRegister
-                from qiskit import QISKitError
-        """
-        q_program = QuantumProgram()
-        qr1 = q_program.create_quantum_register("qr", 3)
-        self.assertIsInstance(qr1, QuantumRegister)
-        self.assertRaises(QISKitError, q_program.create_quantum_register,
-                          "qr", 2)
-
-    def test_fail_create_classical_register(self):
-        """Test create_quantum_register.
-
-        If all is correct we get a object instance of QuantumRegister and
-        QISKitError
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-                from qiskit import QuantumRegister
-                from qiskit import QISKitError
-        """
-        q_program = QuantumProgram()
-        cr1 = q_program.create_classical_register("cr", 3)
-        self.assertIsInstance(cr1, ClassicalRegister)
-        self.assertRaises(QISKitError,
-                          q_program.create_classical_register, "cr", 2)
-
-    def test_create_quantum_register_same(self):
-        """Test create_quantum_register of same name and size.
-
-        If all is correct we get a single classical register
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-                from qiskit import QuantumRegister
-        """
-        q_program = QuantumProgram()
-        qr1 = q_program.create_quantum_register("qr", 3)
-        qr2 = q_program.create_quantum_register("qr", 3)
-        self.assertIs(qr1, qr2)
-
-    def test_create_classical_register_same(self):
-        """Test create_classical_register of same name and size.
-
-        If all is correct we get a single classical register
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-                from qiskit import ClassicalRegister
-        """
-        q_program = QuantumProgram()
-        cr1 = q_program.create_classical_register("cr", 3)
-        cr2 = q_program.create_classical_register("cr", 3)
-        self.assertIs(cr1, cr2)
-
-    def test_create_classical_registers(self):
-        """Test create_classical_registers.
-
-        If all is correct we get a object instance of list[ClassicalRegister]
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-                from qiskit import ClassicalRegister
-        """
-        q_program = QuantumProgram()
-        classical_registers = [{"name": "c1", "size": 4},
-                               {"name": "c2", "size": 2}]
-        crs = q_program.create_classical_registers(classical_registers)
-        for i in crs:
-            self.assertIsInstance(i, ClassicalRegister)
-
-    def test_create_quantum_registers(self):
-        """Test create_quantum_registers.
-
-        If all is correct we get a object instance of list[QuantumRegister]
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-                from qiskit import QuantumRegister
-        """
-        q_program = QuantumProgram()
-        quantum_registers = [{"name": "q1", "size": 4},
-                             {"name": "q2", "size": 2}]
-        qrs = q_program.create_quantum_registers(quantum_registers)
-        for i in qrs:
-            self.assertIsInstance(i, QuantumRegister)
-
-    def test_destroy_classical_register(self):
-        """Test destroy_classical_register."""
-        q_program = QuantumProgram()
-        _ = q_program.create_classical_register('c1', 3)
-        self.assertIn('c1', q_program.get_classical_register_names())
-        q_program.destroy_classical_register('c1')
-        self.assertNotIn('c1', q_program.get_classical_register_names())
-
-        # Destroying an invalid register should fail.
-        with self.assertRaises(QISKitError) as context_manager:
-            q_program.destroy_classical_register('c1')
-        self.assertIn('Not present', str(context_manager.exception))
-
-    def test_destroy_quantum_register(self):
-        """Test destroy_quantum_register."""
-        q_program = QuantumProgram()
-        _ = q_program.create_quantum_register('q1', 3)
-        self.assertIn('q1', q_program.get_quantum_register_names())
-        q_program.destroy_quantum_register('q1')
-        self.assertNotIn('q1', q_program.get_quantum_register_names())
-
-        # Destroying an invalid register should fail.
-        with self.assertRaises(QISKitError) as context_manager:
-            q_program.destroy_quantum_register('q1')
-        self.assertIn('Not present', str(context_manager.exception))
-
-    def test_create_circuit(self):
-        """Test create_circuit.
-
-        If all is correct we get a object instance of QuantumCircuit
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-                from qiskit import QuantumCircuit
-        """
-        q_program = QuantumProgram()
-        qr = q_program.create_quantum_register("qr", 3)
-        cr = q_program.create_classical_register("cr", 3)
-        qc = q_program.create_circuit("qc", [qr], [cr])
-        self.assertIsInstance(qc, QuantumCircuit)
-
-    def test_create_several_circuits(self):
-        """Test create_circuit with several inputs.
-
-        If all is correct we get a object instance of QuantumCircuit
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-                from qiskit import QuantumCircuit
-        """
-        q_program = QuantumProgram()
-        qr1 = q_program.create_quantum_register("qr1", 3)
-        cr1 = q_program.create_classical_register("cr1", 3)
-        qr2 = q_program.create_quantum_register("qr2", 3)
-        cr2 = q_program.create_classical_register("cr2", 3)
-        qc1 = q_program.create_circuit("qc1", [qr1], [cr1])
-        qc2 = q_program.create_circuit("qc2", [qr2], [cr2])
-        qc3 = q_program.create_circuit("qc2", [qr1, qr2], [cr1, cr2])
-        self.assertIsInstance(qc1, QuantumCircuit)
-        self.assertIsInstance(qc2, QuantumCircuit)
-        self.assertIsInstance(qc3, QuantumCircuit)
-
-    def test_destroy_circuit(self):
-        """Test destroy_circuit."""
-        q_program = QuantumProgram()
-        qr = q_program.create_quantum_register('qr', 3)
-        cr = q_program.create_classical_register('cr', 3)
-        _ = q_program.create_circuit('qc', [qr], [cr])
-        self.assertIn('qc', q_program.get_circuit_names())
-        q_program.destroy_circuit('qc')
-        self.assertNotIn('qc', q_program.get_circuit_names())
-
-        # Destroying an invalid register should fail.
-        with self.assertRaises(QISKitError) as context_manager:
-            q_program.destroy_circuit('qc')
-        self.assertIn('Not present', str(context_manager.exception))
-
-    def test_load_qasm_file(self):
-        """Test load_qasm_file and get_circuit.
-
-        If all is correct we should get the qasm file loaded in qasm_file_path
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-        """
-        q_program = QuantumProgram()
-        name = q_program.load_qasm_file(self.qasm_file_path, name="")
-        result = q_program.get_circuit(name)
-        to_check = result.qasm()
-        self.log.info(to_check)
-        self.assertEqual(len(to_check), 430)
-
-    def test_fail_load_qasm_file(self):
-        """Test fail_load_qasm_file.
-
-        If all is correct we should get a QISKitError
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-                from qiskit import QISKitError
-        """
-        q_program = QuantumProgram()
-        self.assertRaises(QISKitError,
-                          q_program.load_qasm_file, "", name=None)
-
-    def test_load_qasm_text(self):
-        """Test load_qasm_text and get_circuit.
-
-        If all is correct we should get the qasm file loaded from the string
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-        """
-        q_program = QuantumProgram()
-        QASM_string = "// A simple 8 qubit example\nOPENQASM 2.0;\n"
-        QASM_string += "include \"qelib1.inc\";\nqreg a[4];\n"
-        QASM_string += "qreg b[4];\ncreg c[4];\ncreg d[4];\nh a;\ncx a, b;\n"
-        QASM_string += "barrier a;\nbarrier b;\nmeasure a[0]->c[0];\n"
-        QASM_string += "measure a[1]->c[1];\nmeasure a[2]->c[2];\n"
-        QASM_string += "measure a[3]->c[3];\nmeasure b[0]->d[0];\n"
-        QASM_string += "measure b[1]->d[1];\nmeasure b[2]->d[2];\n"
-        QASM_string += "measure b[3]->d[3];"
-        name = q_program.load_qasm_text(QASM_string)
-        result = q_program.get_circuit(name)
-        to_check = result.qasm()
-        self.log.info(to_check)
-        self.assertEqual(len(to_check), 430)
-
-    def test_get_register_and_circuit(self):
-        """Test get_quantum_registers, get_classical_registers, and get_circuit.
-
-        If all is correct we get a object instance of QuantumCircuit,
-        QuantumRegister, ClassicalRegister
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qc = q_program.get_circuit("circuitName")
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-        self.assertIsInstance(qc, QuantumCircuit)
-        self.assertIsInstance(qr, QuantumRegister)
-        self.assertIsInstance(cr, ClassicalRegister)
-
-    def test_get_register_and_circuit_names(self):
-        """Get the names of the circuits and registers.
-
-        If all is correct we should get the arrays of the names
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-        """
-        q_program = QuantumProgram()
-        qr1 = q_program.create_quantum_register("qr1", 3)
-        cr1 = q_program.create_classical_register("cr1", 3)
-        qr2 = q_program.create_quantum_register("qr2", 3)
-        cr2 = q_program.create_classical_register("cr2", 3)
-        q_program.create_circuit("qc1", [qr1], [cr1])
-        q_program.create_circuit("qc2", [qr2], [cr2])
-        q_program.create_circuit("qc2", [qr1, qr2], [cr1, cr2])
-        qrn = q_program.get_quantum_register_names()
-        crn = q_program.get_classical_register_names()
-        qcn = q_program.get_circuit_names()
-        self.assertEqual(qrn, ['qr1', 'qr2'])
-        self.assertEqual(crn, ['cr1', 'cr2'])
-        self.assertEqual(qcn, ['qc1', 'qc2'])
-
-    def test_get_qasm(self):
-        """Test the get_qasm.
-
-        If all correct the qasm output should be of a certain length
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qc = q_program.get_circuit("circuitName")
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-        qc.h(qr[0])
-        qc.cx(qr[0], qr[1])
-        qc.cx(qr[1], qr[2])
-        qc.measure(qr[0], cr[0])
-        qc.measure(qr[1], cr[1])
-        qc.measure(qr[2], cr[2])
-        result = q_program.get_qasm("circuitName")
-        self.assertEqual(len(result), 225)
-
-    def test_get_qasms(self):
-        """Test the get_qasms.
-
-        If all correct the qasm output for each circuit should be of a certain
-        length
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-        """
-        q_program = QuantumProgram()
-        qr = q_program.create_quantum_register("qr", 3)
-        cr = q_program.create_classical_register("cr", 3)
-        qc1 = q_program.create_circuit("qc1", [qr], [cr])
-        qc2 = q_program.create_circuit("qc2", [qr], [cr])
-        qc1.h(qr[0])
-        qc1.cx(qr[0], qr[1])
-        qc1.cx(qr[1], qr[2])
-        qc1.measure(qr[0], cr[0])
-        qc1.measure(qr[1], cr[1])
-        qc1.measure(qr[2], cr[2])
-        qc2.h(qr)
-        qc2.measure(qr[0], cr[0])
-        qc2.measure(qr[1], cr[1])
-        qc2.measure(qr[2], cr[2])
-        result = q_program.get_qasms(["qc1", "qc2"])
-        self.assertEqual(len(result[0]), 173)
-        self.assertEqual(len(result[1]), 159)
-
-    def test_get_qasm_all_gates(self):
-        """Test the get_qasm for more gates.
-
-        If all correct the qasm output should be of a certain length
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qc = q_program.get_circuit("circuitName")
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-        qc.u1(0.3, qr[0])
-        qc.u2(0.2, 0.1, qr[1])
-        qc.u3(0.3, 0.2, 0.1, qr[2])
-        qc.s(qr[1])
-        qc.s(qr[2]).inverse()
-        qc.cx(qr[1], qr[2])
-        qc.barrier()
-        qc.cx(qr[0], qr[1])
-        qc.h(qr[0])
-        qc.x(qr[2]).c_if(cr, 0)
-        qc.y(qr[2]).c_if(cr, 1)
-        qc.z(qr[2]).c_if(cr, 2)
-        qc.barrier(qr)
-        qc.measure(qr[0], cr[0])
-        qc.measure(qr[1], cr[1])
-        qc.measure(qr[2], cr[2])
-        result = q_program.get_qasm('circuitName')
-        self.assertEqual(len(result), 565)
-
-    def test_get_initial_circuit(self):
-        """Test get_initial_circuit.
-
-        If all correct is should be of the circuit form.
-
-        Previously:
-            Libraries:
-                from qiskit import QuantumProgram
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qc = q_program.get_initial_circuit()
-        self.assertIsInstance(qc, QuantumCircuit)
-
-    def test_save(self):
-        """Test save.
-
-        Save a Quantum Program in Json file
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-
-        qc = q_program.get_circuit("circuitName")
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-
-        qc.u3(0.3, 0.2, 0.1, qr[0])
-        qc.h(qr[1])
-        qc.cx(qr[1], qr[2])
-        qc.barrier()
-        qc.cx(qr[0], qr[1])
-        qc.h(qr[0])
-        qc.z(qr[2]).c_if(cr, 1)
-        qc.x(qr[2]).c_if(cr, 1)
-        qc.measure(qr[0], cr[0])
-        qc.measure(qr[1], cr[1])
-
-        result = q_program.save(self._get_resource_path('test_save.json'),
-                                beauty=True)
-
-        self.assertEqual(result['status'], 'Done')
-
-    def test_save_wrong(self):
-        """Test save wrong.
-
-        Save a Quantum Program in Json file: Errors Control
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        self.assertRaises(LookupError, q_program.load)
-
-    def test_load(self):
-        """Test load Json.
-
-        Load a Json Quantum Program
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-
-        result = q_program.load(self._get_resource_path('test_load.json'))
-        self.assertEqual(result['status'], 'Done')
-
-        check_result = q_program.get_qasm('circuitName')
-        self.log.info(check_result)
-        # TODO: revise Sympy 1.2 compatibility. The length is 1775 for
-        # sympy=1.1.x, and 1781 for sympy=1.2
-        self.assertIn(len(check_result), (1775, 1781))
-
-    def test_load_wrong(self):
-        """Test load Json.
-
-        Load a Json Quantum Program: Errors Control.
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        self.assertRaises(LookupError, q_program.load)
-
-    ###############################################################
-    # Tests for working with backends
-    ###############################################################
-
-    @requires_qe_access
-    def test_setup_api(self, qe_token, qe_url):
-        """Check the api is set up.
-
-        If all correct is should be true.
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        q_program.set_api(qe_token, qe_url)
-        config = q_program.get_api_config()
-        self.assertTrue(config)
-
-    @requires_qe_access
-    def test_available_backends_exist(self, qe_token, qe_url):
-        """Test if there are available backends.
-
-        If all correct some should exists (even if offline).
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        q_program.set_api(qe_token, qe_url)
-        available_backends = q_program.available_backends()
-        self.assertTrue(available_backends)
-
-    @requires_qe_access
-    def test_online_backends_exist(self, qe_token, qe_url):
-        """Test if there are online backends.
-
-        If all correct some should exists.
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        q_program.set_api(qe_token, qe_url)
-        online_backends = q_program.online_backends()
-        self.log.info(online_backends)
-        self.assertTrue(online_backends)
-
-    @requires_qe_access
-    def test_online_simulators(self, qe_token, qe_url):
-        """Test if there are online backends (which are simulators).
-
-        If all correct some should exists. NEED internet connection for this.
-        """
-        qp = QuantumProgram(specs=self.QPS_SPECS)
-        qp.set_api(qe_token, qe_url)
-        online_simulators = qp.online_simulators()
-        self.log.info(online_simulators)
-        self.assertTrue(isinstance(online_simulators, list))
-
-    @requires_qe_access
-    def test_online_devices(self, qe_token, qe_url):
-        """Test if there are online backends (which are devices).
-
-        If all correct some should exists. NEED internet connection for this.
-        """
-        qp = QuantumProgram(specs=self.QPS_SPECS)
-        qp.set_api(qe_token, qe_url)
-        online_devices = qp.online_devices()
-        self.log.info(online_devices)
-        self.assertTrue(isinstance(online_devices, list))
-
-    def test_backend_status(self):
-        """Test backend_status.
-
-        If all correct should return dictionary with available: True/False.
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        out = q_program.get_backend_status("local_qasm_simulator")
-        self.assertIn(out['operational'], [True])
-
-    def test_backend_status_fail(self):
-        """Test backend_status.
-
-        If all correct should return dictionary with available: True/False.
-        """
-        qp = QuantumProgram(specs=self.QPS_SPECS)
-        self.assertRaises(LookupError, qp.get_backend_status, "fail")
-
-    def test_get_backend_configuration(self):
-        """Test configuration.
-
-        If all correct should return configuration for the
-        local_qasm_simulator.
-        """
-        qp = QuantumProgram(specs=self.QPS_SPECS)
-        config_keys = {'name', 'simulator', 'local', 'description',
-                       'coupling_map', 'basis_gates'}
-        backend_config = qp.get_backend_configuration("local_qasm_simulator")
-        self.assertTrue(config_keys < backend_config.keys())
-
-    @requires_qe_access
-    def test_get_backend_configuration_online(self, qe_token, qe_url):
-        """Test configuration.
-
-        If all correct should return configuration for the
-        local_qasm_simulator.
-        """
-        qp = QuantumProgram(specs=self.QPS_SPECS)
-        config_keys = {'name', 'simulator', 'local', 'description',
-                       'coupling_map', 'basis_gates'}
-        qp.set_api(qe_token, qe_url)
-        backend_list = qp.available_backends()
-        backend_list.remove('ibmq_qasm_simulator')
-        if backend_list:
-            backend = backend_list[0]
-        backend_config = qp.get_backend_configuration(backend)
-        self.log.info(backend_config)
-        self.assertTrue(config_keys < backend_config.keys())
-
-    def test_get_backend_configuration_fail(self):
-        """Test configuration fail.
-
-        If all correct should return LookupError.
-        """
-        qp = QuantumProgram(specs=self.QPS_SPECS)
-        self.assertRaises(LookupError, qp.get_backend_configuration, "fail")
-
-    @requires_qe_access
-    def test_get_backend_calibration(self, qe_token, qe_url):
-        """Test get_backend_calibration.
-
-        If all correct should return dictionary on length 4.
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        q_program.set_api(qe_token, qe_url)
-        backend_list = q_program.online_devices()
-        if backend_list:
-            backend = backend_list[0]
-        result = q_program.get_backend_calibration(backend)
-        self.log.info(result)
-        self.assertEqual(len(result), 4)
-
-    @requires_qe_access
-    def test_get_backend_parameters(self, qe_token, qe_url):
-        """Test get_backend_parameters.
-
-        If all correct should return dictionary on length 4.
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        q_program.set_api(qe_token, qe_url)
-        backend_list = q_program.online_devices()
-        if backend_list:
-            backend = backend_list[0]
-        result = q_program.get_backend_parameters(backend)
-        self.log.info(result)
-        self.assertTrue(all(key in result for key in ('last_update_date',
-                                                      'qubits', 'backend')))
-
-    ###############################################################
-    # Test for compile
-    ###############################################################
-
-    def test_compile_program(self):
-        """Test compile_program.
-
-        If all correct should return COMPLETED.
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qc = q_program.get_circuit("circuitName")
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-        qc.h(qr[0])
-        qc.cx(qr[0], qr[1])
-        qc.measure(qr[0], cr[0])
-        qc.measure(qr[1], cr[1])
-        backend = 'local_qasm_simulator'
-        coupling_map = None
-        out = q_program.compile(['circuitName'], backend=backend,
-                                coupling_map=coupling_map, qobj_id='cooljob')
-        self.log.info(out)
-        # FIXME should validate the Qobj when defined
-        self.assertIsInstance(out, Qobj)
-
-    def test_get_compiled_configuration(self):
-        """Test compiled_configuration.
-
-        If all correct should return length 4 dictionary.
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qc = q_program.get_circuit("circuitName")
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-        qc.h(qr[0])
-        qc.cx(qr[0], qr[1])
-        qc.measure(qr[0], cr[0])
-        qc.measure(qr[1], cr[1])
-        backend = 'local_qasm_simulator'
-        coupling_map = None
-        qobj = q_program.compile(['circuitName'], backend=backend,
-                                 coupling_map=coupling_map)
-        result = q_program.get_compiled_configuration(qobj, 'circuitName')
-        self.log.info(result)
-        self.assertEqual(len(result), 5)
-
-    def test_get_compiled_qasm(self):
-        """Test get_compiled_qasm.
-
-        If all correct should return length  dictionary.
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qc = q_program.get_circuit("circuitName")
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-        qc.h(qr[0])
-        qc.cx(qr[0], qr[1])
-        qc.measure(qr[0], cr[0])
-        qc.measure(qr[1], cr[1])
-        # cannot interchange simulators here due to differing basis
-        backend = 'local_qasm_simulator_py'
-        coupling_map = None
-        qobj = q_program.compile(['circuitName'], backend=backend,
-                                 coupling_map=coupling_map)
-        result = q_program.get_compiled_qasm(qobj, 'circuitName',)
-        self.log.info(result)
-        self.assertEqual(len(result), 190)
-
-    def test_get_execution_list(self):
-        """Test get_execution_list.
-
-        If all correct should return {'local_qasm_simulator': ['circuitName']}.
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qc = q_program.get_circuit("circuitName")
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-        qc.h(qr[0])
-        qc.cx(qr[0], qr[1])
-        qc.measure(qr[0], cr[0])
-        qc.measure(qr[1], cr[1])
-        backend = 'local_qasm_simulator'
-        coupling_map = None
-        qobj = q_program.compile(['circuitName'], backend=backend,
-                                 coupling_map=coupling_map, qobj_id='cooljob')
-        result = q_program.get_execution_list(qobj, print_func=self.log.info)
-        self.log.info(result)
-        self.assertEqual(result, ['circuitName'])
-
-    def test_compile_coupling_map(self):
-        """Test compile_coupling_map.
-
-        If all correct should return data with the same stats. The circuit may
-        be different.
-        """
-        q_program = QuantumProgram()
-        q = q_program.create_quantum_register("q", 3)
-        c = q_program.create_classical_register("c", 3)
-        qc = q_program.create_circuit("circuitName", [q], [c])
-        qc.h(q[0])
-        qc.cx(q[0], q[1])
-        qc.cx(q[0], q[2])
-        qc.measure(q[0], c[0])
-        qc.measure(q[1], c[1])
-        qc.measure(q[2], c[2])
-        backend = 'local_qasm_simulator'
-        shots = 1024
-        coupling_map = [[0, 1], [1, 2]]
-        initial_layout = {("q", 0): ("q", 0), ("q", 1): ("q", 1),
-                          ("q", 2): ("q", 2)}
-        circuits = ["circuitName"]
-        qobj = q_program.compile(circuits, backend=backend, shots=shots,
-                                 coupling_map=coupling_map,
-                                 initial_layout=initial_layout, seed=88)
-        result = q_program.run(qobj)
-        to_check = q_program.get_qasm("circuitName")
-        self.assertEqual(len(to_check), 160)
-
-        counts = result.get_counts("circuitName")
-        target = {'000': shots / 2, '111': shots / 2}
-        threshold = 0.04 * shots
-        self.assertDictAlmostEqual(counts, target, threshold)
-
-    def test_compile_coupling_map_as_dict(self):
-        """Test compile_coupling_map in dict format (to be deprecated).
-
-        TODO: This test is very specific, and should be removed when the only
-        format allowed for the coupling map is a `list`.
-        """
-        q_program = QuantumProgram()
-        q = q_program.create_quantum_register("q", 3)
-        c = q_program.create_classical_register("c", 3)
-        qc = q_program.create_circuit("circuitName", [q], [c])
-        qc.h(q[0])
-        qc.cx(q[0], q[1])
-        qc.cx(q[0], q[2])
-        qc.measure(q[0], c[0])
-        qc.measure(q[1], c[1])
-        qc.measure(q[2], c[2])
-        backend = 'local_qasm_simulator'
-        shots = 1024
-        coupling_map = {0: [1], 1: [2]}  # as dict
-        initial_layout = {("q", 0): ("q", 0), ("q", 1): ("q", 1),
-                          ("q", 2): ("q", 2)}
-        circuits = ["circuitName"]
-        with self.assertWarns(DeprecationWarning):
-            qobj = q_program.compile(circuits, backend=backend, shots=shots,
-                                     coupling_map=coupling_map,
-                                     initial_layout=initial_layout, seed=88)
-        result = q_program.run(qobj)
-        to_check = q_program.get_qasm("circuitName")
-        self.assertEqual(len(to_check), 160)
-        counts = result.get_counts("circuitName")
-        target = {'000': shots / 2, '111': shots / 2}
-        threshold = 0.04 * shots
-        self.assertDictAlmostEqual(counts, target, threshold)
-
-    def test_change_circuit_qobj_after_compile(self):
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-        qc2 = q_program.create_circuit("qc2", [qr], [cr])
-        qc3 = q_program.create_circuit("qc3", [qr], [cr])
-        qc2.h(qr[0])
-        qc2.cx(qr[0], qr[1])
-        qc2.cx(qr[0], qr[2])
-        qc3.h(qr)
-        qc2.measure(qr, cr)
-        qc3.measure(qr, cr)
-        circuits = ['qc2', 'qc3']
-        shots = 1024
-        backend = 'local_qasm_simulator'
-        config = {'seed': 10, 'shots': 1, 'xvals': [1, 2, 3, 4]}
-        qobj1 = q_program.compile(circuits, backend=backend, shots=shots,
-                                  seed=88, config=config)
-        qobj1.experiments[0].config.shots = 50
-        qobj1.experiments[0].config.xvals = [1, 1, 1]
-        config['shots'] = 1000
-        config['xvals'][0] = 'only for qobj2'
-        qobj2 = q_program.compile(circuits, backend=backend, shots=shots,
-                                  seed=88, config=config)
-        self.assertTrue(qobj1.experiments[0].config.shots == 50)
-        self.assertTrue(qobj1.experiments[1].config.shots == 1)
-        self.assertTrue(qobj1.experiments[0].config.xvals == [1, 1, 1])
-        self.assertTrue(qobj1.experiments[1].config.xvals == [1, 2, 3, 4])
-        self.assertTrue(qobj1.config.shots == 1024)
-        self.assertTrue(qobj2.experiments[0].config.shots == 1000)
-        self.assertTrue(qobj2.experiments[1].config.shots == 1000)
-        self.assertTrue(qobj2.experiments[0].config.xvals == [
-            'only for qobj2', 2, 3, 4])
-        self.assertTrue(qobj2.experiments[1].config.xvals == [
-            'only for qobj2', 2, 3, 4])
-
-    ###############################################################
-    # Test for running programs
-    ###############################################################
-
-    def test_run_program(self):
-        """Test run.
-
-        If all correct should the data.
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-        qc2 = q_program.create_circuit("qc2", [qr], [cr])
-        qc3 = q_program.create_circuit("qc3", [qr], [cr])
-        qc2.h(qr[0])
-        qc2.cx(qr[0], qr[1])
-        qc2.cx(qr[0], qr[2])
-        qc3.h(qr)
-        qc2.measure(qr, cr)
-        qc3.measure(qr, cr)
-        circuits = ['qc2', 'qc3']
-        shots = 1024
-        backend = 'local_qasm_simulator'
-        qobj = q_program.compile(circuits, backend=backend, shots=shots,
-                                 seed=88)
-        result = q_program.run(qobj)
-        counts2 = result.get_counts("qc2")
-        counts3 = result.get_counts("qc3")
-        target2 = {'000': shots / 2, '111': shots / 2}
-        target3 = {'000': shots / 8, '001': shots / 8, '010': shots / 8,
-                   '011': shots / 8, '100': shots / 8, '101': shots / 8,
-                   '110': shots / 8, '111': shots / 8}
-        threshold = 0.04 * shots
-        self.assertDictAlmostEqual(counts2, target2, threshold)
-        self.assertDictAlmostEqual(counts3, target3, threshold)
-
-    def test_combine_results(self):
-        """Test run.
-
-        If all correct should the data.
-        """
-        q_program = QuantumProgram()
-        qr = q_program.create_quantum_register("qr", 1)
-        cr = q_program.create_classical_register("cr", 1)
-        qc1 = q_program.create_circuit("qc1", [qr], [cr])
-        qc2 = q_program.create_circuit("qc2", [qr], [cr])
-        qc1.measure(qr[0], cr[0])
-        qc2.x(qr[0])
-        qc2.measure(qr[0], cr[0])
-        shots = 1024
-        backend = 'local_qasm_simulator'
-        res1 = q_program.execute(['qc1'], backend=backend, shots=shots)
-        res2 = q_program.execute(['qc2'], backend=backend, shots=shots)
-        counts1 = res1.get_counts('qc1')
-        counts2 = res2.get_counts('qc2')
-        res1 += res2  # combine results
-        counts12 = [res1.get_counts('qc1'), res1.get_counts('qc2')]
-        self.assertEqual(counts12, [counts1, counts2])
-
-    def test_local_qasm_simulator(self):
-        """Test execute.
-
-        If all correct should the data.
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-        qc2 = q_program.create_circuit("qc2", [qr], [cr])
-        qc3 = q_program.create_circuit("qc3", [qr], [cr])
-        qc2.h(qr[0])
-        qc2.cx(qr[0], qr[1])
-        qc2.cx(qr[0], qr[2])
-        qc3.h(qr)
-        qc2.measure(qr[0], cr[0])
-        qc3.measure(qr[0], cr[0])
-        qc2.measure(qr[1], cr[1])
-        qc3.measure(qr[1], cr[1])
-        qc2.measure(qr[2], cr[2])
-        qc3.measure(qr[2], cr[2])
-        circuits = ['qc2', 'qc3']
-        shots = 1024
-        backend = 'local_qasm_simulator'
-        result = q_program.execute(circuits, backend=backend, shots=shots,
-                                   seed=88)
-        counts2 = result.get_counts("qc2")
-        counts3 = result.get_counts("qc3")
-        target2 = {'000': shots / 2, '111': shots / 2}
-        target3 = {'000': shots / 8, '001': shots / 8, '010': shots / 8,
-                   '011': shots / 8, '100': shots / 8, '101': shots / 8,
-                   '110': shots / 8, '111': shots / 8}
-        threshold = 0.04 * shots
-        self.assertDictAlmostEqual(counts2, target2, threshold)
-        self.assertDictAlmostEqual(counts3, target3, threshold)
-
-    def test_local_qasm_simulator_one_shot(self):
-        """Test single shot of local simulator .
-
-        If all correct should the quantum state.
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-        qc2 = q_program.create_circuit("qc2", [qr], [cr])
-        qc3 = q_program.create_circuit("qc3", [qr], [cr])
-        qc2.h(qr[0])
-        qc3.h(qr[0])
-        qc3.cx(qr[0], qr[1])
-        qc3.cx(qr[0], qr[2])
-        circuits = ['qc2', 'qc3']
-        # the behavior of getting statevector from 1 shot only existed in py simulator
-        backend = 'local_qasm_simulator_py'
-        shots = 1
-        result = q_program.execute(circuits, backend=backend, shots=shots,
-                                   seed=9)
-        statevector = np.array([0.70710678+0.j, 0.70710678+0.j,
-                                0.00000000+0.j, 0.00000000+0.j,
-                                0.00000000+0.j, 0.00000000+0.j,
-                                0.00000000+0.j, 0.00000000+0.j])
-        norm = np.dot(np.conj(statevector),
-                      result.get_data('qc2')['statevector'])
-        self.assertAlmostEqual(norm, 1)
-        statevector = np.array([0.70710678+0.j, 0+0.j,
-                                0.00000000+0.j, 0.00000000+0.j,
-                                0.00000000+0.j, 0.00000000+0.j,
-                                0.00000000+0.j, 0.70710678+0.j])
-        norm = np.dot(np.conj(statevector),
-                      result.get_data('qc3')['statevector'])
-        self.assertAlmostEqual(norm, 1)
-
-    def test_local_unitary_simulator(self):
-        """Test unitary simulator.
-
-        If all correct should the hxh and cx.
-        """
-        q_program = QuantumProgram()
-        q = q_program.create_quantum_register("q", 2)
-        c = q_program.create_classical_register("c", 2)
-        qc1 = q_program.create_circuit("qc1", [q], [c])
-        qc2 = q_program.create_circuit("qc2", [q], [c])
-        qc1.h(q)
-        qc2.cx(q[0], q[1])
-        circuits = ['qc1', 'qc2']
-        backend = 'local_unitary_simulator'
-        result = q_program.execute(circuits, backend=backend)
-        unitary1 = result.get_data('qc1')['unitary']
-        unitary2 = result.get_data('qc2')['unitary']
-        unitaryreal1 = np.array([[0.5, 0.5, 0.5, 0.5], [0.5, -0.5, 0.5, -0.5],
-                                 [0.5, 0.5, -0.5, -0.5],
-                                 [0.5, -0.5, -0.5, 0.5]])
-        unitaryreal2 = np.array([[1, 0, 0, 0], [0, 0, 0, 1],
-                                 [0., 0, 1, 0], [0, 1, 0, 0]])
-        norm1 = np.trace(np.dot(np.transpose(np.conj(unitaryreal1)), unitary1))
-        norm2 = np.trace(np.dot(np.transpose(np.conj(unitaryreal2)), unitary2))
-        self.assertAlmostEqual(norm1, 4)
-        self.assertAlmostEqual(norm2, 4)
-
-    def test_run_program_map(self):
-        """Test run_program_map.
-
-        If all correct should return 10010.
-        """
-        q_program = QuantumProgram()
-        backend = 'local_qasm_simulator'
-        shots = 100
-        max_credits = 3
-        coupling_map = [[0, 1], [1, 2], [2, 3], [3, 4]]
-        initial_layout = {("q", 0): ("q", 0), ("q", 1): ("q", 1),
-                          ("q", 2): ("q", 2), ("q", 3): ("q", 3),
-                          ("q", 4): ("q", 4)}
-        q_program.load_qasm_file(self.qasm_file_path_2, name="circuit-dev")
-        circuits = ["circuit-dev"]
-        qobj = q_program.compile(circuits, backend=backend, shots=shots,
-                                 max_credits=max_credits, seed=65,
-                                 coupling_map=coupling_map,
-                                 initial_layout=initial_layout)
-        result = q_program.run(qobj)
-        self.assertEqual(result.get_counts("circuit-dev"), {'10010': 100})
-
-    def test_execute_program_map(self):
-        """Test execute_program_map.
-
-        If all correct should return 10010.
-        """
-        q_program = QuantumProgram()
-        backend = 'local_qasm_simulator'
-        shots = 100
-        max_credits = 3
-        coupling_map = [[0, 1], [1, 2], [2, 3], [3, 4]]
-        initial_layout = {("q", 0): ("q", 0), ("q", 1): ("q", 1),
-                          ("q", 2): ("q", 2), ("q", 3): ("q", 3),
-                          ("q", 4): ("q", 4)}
-        q_program.load_qasm_file(self.qasm_file_path_2, "circuit-dev")
-        circuits = ["circuit-dev"]
-        result = q_program.execute(circuits, backend=backend, shots=shots,
-                                   max_credits=max_credits,
-                                   coupling_map=coupling_map,
-                                   initial_layout=initial_layout, seed=5455)
-        self.assertEqual(result.get_counts("circuit-dev"), {'10010': 100})
-
-    def test_average_data(self):
-        """Test average_data.
-
-        If all correct should return the data.
-        """
-        q_program = QuantumProgram()
-        q = q_program.create_quantum_register("q", 2)
-        c = q_program.create_classical_register("c", 2)
-        qc = q_program.create_circuit("qc", [q], [c])
-        qc.h(q[0])
-        qc.cx(q[0], q[1])
-        qc.measure(q[0], c[0])
-        qc.measure(q[1], c[1])
-        circuits = ['qc']
-        shots = 10000
-        backend = 'local_qasm_simulator'
-        results = q_program.execute(circuits, backend=backend, shots=shots)
-        observable = {"00": 1, "11": 1, "01": -1, "10": -1}
-        mean_zz = results.average_data("qc", observable)
-        observable = {"00": 1, "11": -1, "01": 1, "10": -1}
-        mean_zi = results.average_data("qc", observable)
-        observable = {"00": 1, "11": -1, "01": -1, "10": 1}
-        mean_iz = results.average_data("qc", observable)
-        self.assertAlmostEqual(mean_zz, 1, places=1)
-        self.assertAlmostEqual(mean_zi, 0, places=1)
-        self.assertAlmostEqual(mean_iz, 0, places=1)
-
-    @requires_qe_access
-    def test_execute_one_circuit_simulator_online(self, qe_token, qe_url):
-        """Test execute_one_circuit_simulator_online.
-
-        If all correct should return the data.
-        """
-        q_program = QuantumProgram()
-        qr = q_program.create_quantum_register("q", 1)
-        cr = q_program.create_classical_register("c", 1)
-        qc = q_program.create_circuit("qc", [qr], [cr])
-        qc.h(qr[0])
-        qc.measure(qr[0], cr[0])
-        shots = 1024
-        q_program.set_api(qe_token, qe_url)
-        backend = 'ibmq_qasm_simulator'
-        result = q_program.execute(['qc'], backend=backend,
-                                   shots=shots, max_credits=3,
-                                   seed=73846087)
-        counts = result.get_counts('qc')
-        target = {'0': shots / 2, '1': shots / 2}
-        threshold = 0.04 * shots
-        self.assertDictAlmostEqual(counts, target, threshold)
-
-    @requires_qe_access
-    def test_execute_several_circuits_simulator_online(self, qe_token, qe_url):
-        """Test execute_several_circuits_simulator_online.
-
-        If all correct should return the data.
-        """
-        q_program = QuantumProgram()
-        qr = q_program.create_quantum_register("q", 2)
-        cr = q_program.create_classical_register("c", 2)
-        qc1 = q_program.create_circuit("qc1", [qr], [cr])
-        qc2 = q_program.create_circuit("qc2", [qr], [cr])
-        qc1.h(qr)
-        qc2.h(qr[0])
-        qc2.cx(qr[0], qr[1])
-        qc1.measure(qr[0], cr[0])
-        qc1.measure(qr[1], cr[1])
-        qc2.measure(qr[0], cr[0])
-        qc2.measure(qr[1], cr[1])
-        circuits = ['qc1', 'qc2']
-        shots = 1024
-        q_program.set_api(qe_token, qe_url)
-        backend = 'ibmq_qasm_simulator'
-        result = q_program.execute(circuits, backend=backend, shots=shots,
-                                   max_credits=3, seed=1287126141)
-        counts1 = result.get_counts('qc1')
-        counts2 = result.get_counts('qc2')
-        target1 = {'00': shots / 4, '01': shots / 4,
-                   '10': shots / 4, '11': shots / 4}
-        target2 = {'00': shots / 2, '11': shots / 2}
-        threshold = 0.04 * shots
-        self.assertDictAlmostEqual(counts1, target1, threshold)
-        self.assertDictAlmostEqual(counts2, target2, threshold)
-
-    @requires_qe_access
-    def test_execute_one_circuit_real_online(self, qe_token, qe_url):
-        """Test execute_one_circuit_real_online.
-
-        If all correct should return a result object
-        """
-        q_program = QuantumProgram()
-        qr = q_program.create_quantum_register("qr", 1)
-        cr = q_program.create_classical_register("cr", 1)
-        qc = q_program.create_circuit("circuitName", [qr], [cr])
-        qc.h(qr)
-        qc.measure(qr[0], cr[0])
-        q_program.set_api(qe_token, qe_url)
-        backend = 'ibmq_qasm_simulator'
-        shots = 1
-        status = q_program.get_backend_status(backend)
-        if not status.get('operational', False):
-            pass
-        else:
-            result = q_program.execute(['circuitName'], backend=backend,
-                                       shots=shots, max_credits=3)
-            self.assertIsInstance(result, Result)
-
-    @unittest.skipIf(version_info.minor == 5,
-                     "Due to gate ordering issues with Python 3.5 "
-                     "we have to disable this test until fixed")
-    def test_local_qasm_simulator_two_registers(self):
-        """Test local_qasm_simulator_two_registers.
-
-        If all correct should the data.
-        """
-        q_program = QuantumProgram()
-        q1 = q_program.create_quantum_register("q1", 2)
-        c1 = q_program.create_classical_register("c1", 2)
-        q2 = q_program.create_quantum_register("q2", 2)
-        c2 = q_program.create_classical_register("c2", 2)
-        qc1 = q_program.create_circuit("qc1", [q1, q2], [c1, c2])
-        qc2 = q_program.create_circuit("qc2", [q1, q2], [c1, c2])
-
-        qc1.x(q1[0])
-        qc2.x(q2[1])
-        qc1.measure(q1[0], c1[0])
-        qc1.measure(q1[1], c1[1])
-        qc1.measure(q2[0], c2[0])
-        qc1.measure(q2[1], c2[1])
-        qc2.measure(q1[0], c1[0])
-        qc2.measure(q1[1], c1[1])
-        qc2.measure(q2[0], c2[0])
-        qc2.measure(q2[1], c2[1])
-        circuits = ['qc1', 'qc2']
-        shots = 1024
-        backend = 'local_qasm_simulator'
-        result = q_program.execute(circuits, backend=backend, shots=shots,
-                                   seed=8458)
-        result1 = result.get_counts('qc1')
-        result2 = result.get_counts('qc2')
-        self.assertEqual(result1, {'00 01': 1024})
-        self.assertEqual(result2, {'10 00': 1024})
-
-    @requires_qe_access
-    def test_online_qasm_simulator_two_registers(self, qe_token, qe_url):
-        """Test online_qasm_simulator_two_registers.
-
-        If all correct should the data.
-        """
-        q_program = QuantumProgram()
-        q1 = q_program.create_quantum_register("q1", 2)
-        c1 = q_program.create_classical_register("c1", 2)
-        q2 = q_program.create_quantum_register("q2", 2)
-        c2 = q_program.create_classical_register("c2", 2)
-        qc1 = q_program.create_circuit("qc1", [q1, q2], [c1, c2])
-        qc2 = q_program.create_circuit("qc2", [q1, q2], [c1, c2])
-
-        qc1.x(q1[0])
-        qc2.x(q2[1])
-        qc1.measure(q1[0], c1[0])
-        qc1.measure(q1[1], c1[1])
-        qc1.measure(q2[0], c2[0])
-        qc1.measure(q2[1], c2[1])
-        qc2.measure(q1[0], c1[0])
-        qc2.measure(q1[1], c1[1])
-        qc2.measure(q2[0], c2[0])
-        qc2.measure(q2[1], c2[1])
-        circuits = ['qc1', 'qc2']
-        shots = 1024
-        q_program.set_api(qe_token, qe_url)
-        backend = 'ibmq_qasm_simulator'
-        result = q_program.execute(circuits, backend=backend, shots=shots,
-                                   seed=8458)
-        result1 = result.get_counts('qc1')
-        result2 = result.get_counts('qc2')
-        self.assertEqual(result1, {'00 01': 1024})
-        self.assertEqual(result2, {'10 00': 1024})
-
-    ###############################################################
-    # More test cases for interesting examples
-    ###############################################################
-
-    def test_example_multiple_compile(self):
-        """Test a toy example compiling multiple circuits.
-
-        Pass if the results are correct.
-        """
-        coupling_map = [[0, 1], [0, 2],
-                        [1, 2],
-                        [3, 2], [3, 4],
-                        [4, 2]]
-        QPS_SPECS = {
-            "circuits": [
-                {
-                    "name": "ghz",
-                    "quantum_registers": [{
-                        "name": "q",
-                        "size": 5
-                    }],
-                    "classical_registers": [{
-                        "name": "c",
-                        "size": 5}]
-                },
-                {
-                    "name": "bell",
-                    "quantum_registers": [{
-                        "name": "q",
-                        "size": 5
-                    }],
-                    "classical_registers": [{
-                        "name": "c",
-                        "size": 5}]
-                }
-            ]
-        }
-        qp = QuantumProgram(specs=QPS_SPECS)
-        ghz = qp.get_circuit("ghz")
-        bell = qp.get_circuit("bell")
-        q = qp.get_quantum_register("q")
-        c = qp.get_classical_register("c")
-        # Create a GHZ state
-        ghz.h(q[0])
-        for i in range(4):
-            ghz.cx(q[i], q[i+1])
-        # Insert a barrier before measurement
-        ghz.barrier()
-        # Measure all of the qubits in the standard basis
-        for i in range(5):
-            ghz.measure(q[i], c[i])
-        # Create a Bell state
-        bell.h(q[0])
-        bell.cx(q[0], q[1])
-        bell.barrier()
-        bell.measure(q[0], c[0])
-        bell.measure(q[1], c[1])
-        shots = 2048
-        bellobj = qp.compile(["bell"], backend='local_qasm_simulator',
-                             shots=shots, seed=10)
-        ghzobj = qp.compile(["ghz"], backend='local_qasm_simulator',
-                            shots=shots, coupling_map=coupling_map,
-                            seed=10)
-        bellresult = qp.run(bellobj)
-        ghzresult = qp.run(ghzobj)
-        self.log.info(bellresult.get_counts("bell"))
-        self.log.info(ghzresult.get_counts("ghz"))
-
-        threshold = 0.04 * shots
-        counts_bell = bellresult.get_counts('bell')
-        target_bell = {'00000': shots / 2, '00011': shots / 2}
-        self.assertDictAlmostEqual(counts_bell, target_bell, threshold)
-
-        counts_ghz = ghzresult.get_counts('ghz')
-        target_ghz = {'00000': shots / 2, '11111': shots / 2}
-        self.assertDictAlmostEqual(counts_ghz, target_ghz, threshold)
-
-    def test_example_swap_bits(self):
-        """Test a toy example swapping a set bit around.
-
-        Uses the mapper. Pass if results are correct.
-        """
-        coupling_map = [[0, 1], [0, 8], [1, 2], [1, 9], [2, 3], [2, 10],
-                        [3, 4], [3, 11], [4, 5], [4, 12], [5, 6], [5, 13],
-                        [6, 7], [6, 14], [7, 15], [8, 9], [9, 10], [10, 11],
-                        [11, 12], [12, 13], [13, 14], [14, 15]]
-
-        def swap(qc, q0, q1):
-            """Swap gate."""
-            qc.cx(q0, q1)
-            qc.cx(q1, q0)
-            qc.cx(q0, q1)
-        n = 3  # make this at least 3
-        QPS_SPECS = {
-            "circuits": [
-                {
-                    "name": "swapping",
-                    "quantum_registers": [
-                        {
-                            "name": "q",
-                            "size": n
-                        },
-                        {
-                            "name": "r",
-                            "size": n
-                        }
-                    ],
-                    "classical_registers": [
-                        {
-                            "name": "ans",
-                            "size": 2*n
-                        },
-                    ]
-                }
-            ]
-        }
-        qp = QuantumProgram(specs=QPS_SPECS)
-        backend = 'local_qasm_simulator'
-        qc = qp.get_circuit("swapping")
-        q = qp.get_quantum_register("q")
-        r = qp.get_quantum_register("r")
-        ans = qp.get_classical_register("ans")
-        # Set the first bit of q
-        qc.x(q[0])
-        # Swap the set bit
-        swap(qc, q[0], q[n-1])
-        swap(qc, q[n-1], r[n-1])
-        swap(qc, r[n-1], q[1])
-        swap(qc, q[1], r[1])
-        # Insert a barrier before measurement
-        qc.barrier()
-        # Measure all of the qubits in the standard basis
-        for j in range(n):
-            qc.measure(q[j], ans[j])
-            qc.measure(r[j], ans[j+n])
-        # First version: no mapping
-        result = qp.execute(["swapping"], backend=backend,
-                            coupling_map=None, shots=1024,
-                            seed=14)
-        self.assertEqual(result.get_counts("swapping"),
-                         {'010000': 1024})
-        # Second version: map to coupling graph
-        result = qp.execute(["swapping"], backend=backend,
-                            coupling_map=coupling_map, shots=1024,
-                            seed=14)
-        self.assertEqual(result.get_counts("swapping"),
-                         {'010000': 1024})
-
-    def test_offline(self):
-        import string
-        import random
-        qp = QuantumProgram()
-        FAKE_TOKEN = 'this_token_is_not_going_to_be_sent_nowhere'
-        FAKE_URL = 'http://{0}.com'.format(
-            ''.join(random.choice(string.ascii_lowercase) for _ in range(63))
-        )
-        # SDK will throw ConnectionError on every call that implies a connection
-        self.assertRaises(QISKitError, qp.set_api, FAKE_TOKEN, FAKE_URL)
-
-    def test_results_save_load(self):
-        """Test saving and loading the results of a circuit.
-
-        Test for the 'local_unitary_simulator' and 'local_qasm_simulator'
-        """
-        q_program = QuantumProgram()
-        metadata = {'testval': 5}
-        q = q_program.create_quantum_register("q", 2)
-        c = q_program.create_classical_register("c", 2)
-        qc1 = q_program.create_circuit("qc1", [q], [c])
-        qc2 = q_program.create_circuit("qc2", [q], [c])
-        qc1.h(q)
-        qc2.cx(q[0], q[1])
-        circuits = ['qc1', 'qc2']
-
-        result1 = q_program.execute(circuits, backend='local_unitary_simulator')
-        result2 = q_program.execute(circuits, backend='local_qasm_simulator')
-
-        test_1_path = self._get_resource_path('test_save_load1.json')
-        test_2_path = self._get_resource_path('test_save_load2.json')
-
-        # delete these files if they exist
-        if os.path.exists(test_1_path):
-            os.remove(test_1_path)
-
-        if os.path.exists(test_2_path):
-            os.remove(test_2_path)
-
-        file1 = file_io.save_result_to_file(result1, test_1_path, metadata=metadata)
-        file2 = file_io.save_result_to_file(result2, test_2_path, metadata=metadata)
-
-        _, metadata_loaded1 = file_io.load_result_from_file(file1)
-        _, metadata_loaded2 = file_io.load_result_from_file(file1)
-
-        self.assertAlmostEqual(metadata_loaded1['testval'], 5)
-        self.assertAlmostEqual(metadata_loaded2['testval'], 5)
-
-        # remove files to keep directory clean
-        os.remove(file1)
-        os.remove(file2)
-
-    def test_qubitpol(self):
-        """Test the results of the qubitpol function in Results. Do two 2Q circuits
-        in the first do nothing and in the second do X on the first qubit.
-        """
-        q_program = QuantumProgram()
-        q = q_program.create_quantum_register("q", 2)
-        c = q_program.create_classical_register("c", 2)
-        qc1 = q_program.create_circuit("qc1", [q], [c])
-        qc2 = q_program.create_circuit("qc2", [q], [c])
-        qc2.x(q[0])
-        qc1.measure(q, c)
-        qc2.measure(q, c)
-        circuits = ['qc1', 'qc2']
-        xvals_dict = {circuits[0]: 0, circuits[1]: 1}
-
-        result = q_program.execute(circuits, backend='local_qasm_simulator')
-
-        yvals, xvals = result.get_qubitpol_vs_xval(2, xvals_dict=xvals_dict)
-
-        self.assertTrue(np.array_equal(yvals, [[-1, -1], [1, -1]]))
-        self.assertTrue(np.array_equal(xvals, [0, 1]))
-
-    def test_ccx(self):
-        """Checks a Toffoli gate.
-
-        Based on https://github.com/QISKit/qiskit-terra/pull/172.
-        """
-        Q_program = QuantumProgram()
-        q = Q_program.create_quantum_register('q', 3)
-        c = Q_program.create_classical_register('c', 3)
-        pqm = Q_program.create_circuit('pqm', [q], [c])
-
-        # Toffoli gate.
-        pqm.ccx(q[0], q[1], q[2])
-
-        # Measurement.
-        for k in range(3):
-            pqm.measure(q[k], c[k])
-
-        # Prepare run.
-        circuits = ['pqm']
-        backend = 'local_qasm_simulator'
-        shots = 1024
-
-        # Run.
-        result = Q_program.execute(circuits, backend=backend, shots=shots,
-                                   max_credits=3, timeout=240)
-
-        self.assertEqual({'000': 1024}, result.get_counts('pqm'))
-
-    def test_reconfig(self):
-        """Test reconfiguring the qobj from 1024 shots to 2048 using
-        reconfig instead of recompile
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-        qc2 = q_program.create_circuit("qc2", [qr], [cr])
-        qc2.measure(qr[0], cr[0])
-        qc2.measure(qr[1], cr[1])
-        qc2.measure(qr[2], cr[2])
-        shots = 1024
-        backend = 'local_qasm_simulator'
-        test_config = {'foo': 0, 'bar': 1}
-        qobj = q_program.compile(['qc2'], backend=backend, shots=shots, config=test_config)
-        out = q_program.run(qobj)
-        results = out.get_counts('qc2')
-
-        # change the number of shots and re-run to test if the reconfig does not break
-        # the ability to run the qobj
-        qobj = q_program.reconfig(qobj, shots=2048)
-        out2 = q_program.run(qobj)
-        results2 = out2.get_counts('qc2')
-
-        self.assertEqual(results, {'000': 1024})
-        self.assertEqual(results2, {'000': 2048})
-
-        # change backend
-        qobj = q_program.reconfig(qobj, backend='local_unitary_simulator')
-        self.assertEqual(qobj.config.backend, 'local_unitary_simulator')
-        # change maxcredits
-        qobj = q_program.reconfig(qobj, max_credits=11)
-        self.assertEqual(qobj.config.max_credits, 11)
-        # change seed
-        qobj = q_program.reconfig(qobj, seed=11)
-        self.assertEqual(qobj.experiments[0].config.seed, 11)
-        # change the config
-        test_config_2 = {'foo': 2}
-        qobj = q_program.reconfig(qobj, config=test_config_2)
-        self.assertEqual(qobj.experiments[0].config.foo, 2)
-        self.assertEqual(qobj.experiments[0].config.bar, 1)
-
-    def test_timeout(self):
-        """Test run.
-
-        If all correct should the data.
-        """
-        # TODO: instead of skipping, the test should be fixed in Windows
-        # platforms. It currently fails during registering DummySimulator.
-        if os.name == 'nt':
-            raise unittest.SkipTest('Test not supported in Windows')
-
-        # TODO: use the backend directly when the deprecation is completed.
-        from ._mockutils import DummyProvider
-        import qiskit.wrapper
-        qiskit.wrapper._wrapper._DEFAULT_PROVIDER.add_provider(DummyProvider())
-
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-        qc2 = q_program.create_circuit("qc2", [qr], [cr])
-        qc2.h(qr[0])
-        qc2.cx(qr[0], qr[1])
-        qc2.cx(qr[0], qr[2])
-        qc2.measure(qr, cr)
-        circuits = ['qc2']
-        shots = 1024
-        backend = 'local_dummy_simulator'
-        qobj = q_program.compile(circuits, backend=backend, shots=shots,
-                                 seed=88)
-        from concurrent import futures
-        self.assertRaises(futures.TimeoutError, q_program.run, qobj,
-                          timeout=0.01)
-
-    @requires_qe_access
-    def test_hpc_parameter_is_correct(self, qe_token, qe_url):
-        """Test for checking HPC parameter in compile() method.
-        It must be only used when the backend is ibmq_qasm_simulator (HPC).
-        It will warn the user if the parameter is passed correctly but the
-        backend is not ibmq_qasm_simulator (HPC).
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-        qc2 = q_program.create_circuit("qc2", [qr], [cr])
-        qc2.h(qr[0])
-        qc2.cx(qr[0], qr[1])
-        qc2.cx(qr[0], qr[2])
-        qc2.measure(qr, cr)
-        circuits = ['qc2']
-        shots = 1
-        backend = 'ibmq_qasm_simulator'
-        q_program.set_api(qe_token, qe_url)
-        qobj = q_program.compile(circuits, backend=backend, shots=shots,
-                                 seed=88,
-                                 hpc={'multi_shot_optimization': True,
-                                      'omp_num_threads': 16})
-        self.assertTrue(qobj)
-
-    @requires_qe_access
-    def test_hpc_parameter_is_incorrect(self, qe_token, qe_url):
-        """Test for checking HPC parameter in compile() method.
-        It must be only used when the backend is ibmq_qasm_simulator (HPC).
-        If the parameter format is incorrect, it will raise a QISKitError.
-        """
-        q_program = QuantumProgram(specs=self.QPS_SPECS)
-        qr = q_program.get_quantum_register("q_name")
-        cr = q_program.get_classical_register("c_name")
-        qc2 = q_program.create_circuit("qc2", [qr], [cr])
-        qc2.h(qr[0])
-        qc2.cx(qr[0], qr[1])
-        qc2.cx(qr[0], qr[2])
-        qc2.measure(qr, cr)
-        circuits = ['qc2']
-        shots = 1
-        backend = 'ibmq_qasm_simulator'
-        q_program.set_api(qe_token, qe_url)
-        self.assertRaises(QISKitError, q_program.compile, circuits,
-                          backend=backend, shots=shots, seed=88,
-                          hpc={'invalid_key': None})
-
-
-if __name__ == '__main__':
-    unittest.main(verbosity=2)
diff --git a/test/python/test_registration.py b/test/python/test_registration.py
--- a/test/python/test_registration.py
+++ b/test/python/test_registration.py
@@ -50,7 +50,7 @@ def test_store_credentials(self):
         self.assertEqual(provider._proxies, {'http': 'foo'})
 
     def test_store_credentials_overwrite(self):
-        """Test overwritind qiskitrc credentials."""
+        """Test overwriting qiskitrc credentials."""
         with custom_qiskitrc():
             qiskit.wrapper.store_credentials('QISKITRC_TOKEN', hub='HUB')
             # Attempt overwriting.
diff --git a/test/python/test_result.py b/test/python/test_result.py
new file mode 100644
--- /dev/null
+++ b/test/python/test_result.py
@@ -0,0 +1,87 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2018, IBM.
+#
+# This source code is licensed under the Apache License, Version 2.0 found in
+# the LICENSE.txt file in the root directory of this source tree.
+
+# pylint: disable=invalid-name,missing-docstring,broad-except,redefined-builtin
+
+"""Test Qiskit Result class."""
+
+import numpy as np
+from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegister
+from qiskit import compile, get_backend
+from .common import QiskitTestCase
+
+
+class TestResult(QiskitTestCase):
+    """Test Qiskit Result class."""
+
+    def test_qubitpol(self):
+        """Test the results of the qubitpol function in Results.
+
+        Do two 2Q circuits: on 1st do nothing, and on 2nd do X on the first qubit.
+        """
+        backend = get_backend('local_qasm_simulator')
+        q = QuantumRegister(2)
+        c = ClassicalRegister(2)
+        qc1 = QuantumCircuit(q, c)
+        qc2 = QuantumCircuit(q, c)
+        qc2.x(q[0])
+        qc1.measure(q, c)
+        qc2.measure(q, c)
+        circuits = [qc1, qc2]
+        xvals_dict = {circuits[0].name: 0, circuits[1].name: 1}
+        qobj = compile(circuits, backend)
+        job = backend.run(qobj)
+        result = job.result()
+        yvals, xvals = result.get_qubitpol_vs_xval(2, xvals_dict=xvals_dict)
+        self.assertTrue(np.array_equal(yvals, [[-1, -1], [1, -1]]))
+        self.assertTrue(np.array_equal(xvals, [0, 1]))
+
+    def test_average_data(self):
+        """Test average_data."""
+        backend = get_backend('local_qasm_simulator')
+        q = QuantumRegister(2)
+        c = ClassicalRegister(2)
+        qc = QuantumCircuit(q, c, name="qc")
+        qc.h(q[0])
+        qc.cx(q[0], q[1])
+        qc.measure(q[0], c[0])
+        qc.measure(q[1], c[1])
+        shots = 10000
+        qobj = compile(qc, backend, shots=shots)
+        job = backend.run(qobj)
+        result = job.result()
+        observable = {"00": 1, "11": 1, "01": -1, "10": -1}
+        mean_zz = result.average_data("qc", observable)
+        observable = {"00": 1, "11": -1, "01": 1, "10": -1}
+        mean_zi = result.average_data("qc", observable)
+        observable = {"00": 1, "11": -1, "01": -1, "10": 1}
+        mean_iz = result.average_data("qc", observable)
+        self.assertAlmostEqual(mean_zz, 1, places=1)
+        self.assertAlmostEqual(mean_zi, 0, places=1)
+        self.assertAlmostEqual(mean_iz, 0, places=1)
+
+    def test_combine_results(self):
+        """Test combining two results."""
+        backend = get_backend('local_qasm_simulator')
+        q = QuantumRegister(1)
+        c = ClassicalRegister(1)
+        qc1 = QuantumCircuit(q, c)
+        qc2 = QuantumCircuit(q, c)
+        qc1.measure(q[0], c[0])
+        qc2.x(q[0])
+        qc2.measure(q[0], c[0])
+        qobj1 = compile(qc1, backend)
+        qobj2 = compile(qc2, backend)
+        job1 = backend.run(qobj1)
+        job2 = backend.run(qobj2)
+        result1 = job1.result()
+        result2 = job2.result()
+        counts1 = result1.get_counts(qc1)
+        counts2 = result2.get_counts(qc2)
+        result1 += result2
+        counts12 = [result1.get_counts(qc1), result1.get_counts(qc2)]
+        self.assertEqual(counts12, [counts1, counts2])
diff --git a/test/python/test_skip_transpiler.py b/test/python/test_skip_transpiler.py
--- a/test/python/test_skip_transpiler.py
+++ b/test/python/test_skip_transpiler.py
@@ -5,12 +5,11 @@
 # This source code is licensed under the Apache License, Version 2.0 found in
 # the LICENSE.txt file in the root directory of this source tree.
 
-# pylint: disable=missing-docstring
+# pylint: disable=missing-docstring, redefined-builtin
 
 import unittest
-
-from qiskit import QuantumProgram
-
+from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
+from qiskit import compile, execute
 from .common import QiskitTestCase
 
 
@@ -18,38 +17,30 @@ class CompileSkipTranslationTest(QiskitTestCase):
     """Test compilaton with skip translation."""
 
     def test_simple_compile(self):
-        """
-        Compares with and without skip_transpiler
-        """
-        name = 'test_simple'
-        qprogram = QuantumProgram()
-        qr = qprogram.create_quantum_register('qr', 2)
-        cr = qprogram.create_classical_register('cr', 2)
-        qc = qprogram.create_circuit(name, [qr], [cr])
+        """Test compile with and without skip_transpiler."""
+        qr = QuantumRegister(2)
+        cr = ClassicalRegister(2)
+        qc = QuantumCircuit(qr, cr)
         qc.u1(3.14, qr[0])
         qc.u2(3.14, 1.57, qr[0])
         qc.measure(qr, cr)
-
-        rtrue = qprogram.compile([name], backend='local_qasm_simulator', shots=1024,
-                                 skip_transpiler=True)
-        rfalse = qprogram.compile([name], backend='local_qasm_simulator', shots=1024,
-                                  skip_transpiler=False)
+        backend = 'local_qasm_simulator'
+        rtrue = compile(qc, backend, skip_transpiler=True)
+        rfalse = compile(qc, backend, skip_transpiler=False)
         self.assertEqual(rtrue.config, rfalse.config)
         self.assertEqual(rtrue.experiments, rfalse.experiments)
 
     def test_simple_execute(self):
-        name = 'test_simple'
-        seed = 42
-        qprogram = QuantumProgram()
-        qr = qprogram.create_quantum_register('qr', 2)
-        cr = qprogram.create_classical_register('cr', 2)
-        qc = qprogram.create_circuit(name, [qr], [cr])
+        """Test execute with and without skip_transpiler."""
+        qr = QuantumRegister(2)
+        cr = ClassicalRegister(2)
+        qc = QuantumCircuit(qr, cr)
         qc.u1(3.14, qr[0])
         qc.u2(3.14, 1.57, qr[0])
         qc.measure(qr, cr)
-
-        rtrue = qprogram.execute(name, seed=seed, skip_transpiler=True)
-        rfalse = qprogram.execute(name, seed=seed, skip_transpiler=False)
+        backend = 'local_qasm_simulator'
+        rtrue = execute(qc, backend, seed=42, skip_transpiler=True).result()
+        rfalse = execute(qc, backend, seed=42, skip_transpiler=False).result()
         self.assertEqual(rtrue.get_counts(), rfalse.get_counts())
 
 
diff --git a/test/python/test_unitary_simulator_py.py b/test/python/test_unitary_simulator_py.py
--- a/test/python/test_unitary_simulator_py.py
+++ b/test/python/test_unitary_simulator_py.py
@@ -8,17 +8,14 @@
 # pylint: disable=missing-docstring
 # pylint: disable=redefined-builtin
 
-import cProfile
-import io
-import pstats
 import unittest
 import numpy as np
 
-from qiskit import (qasm, unroll, QuantumCircuit,
-                    QuantumRegister, ClassicalRegister, compile)
+from qiskit import qasm, unroll
+from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit
+from qiskit import compile
 from qiskit.backends.local.unitary_simulator_py import UnitarySimulatorPy
 from qiskit.qobj import Qobj, QobjItem, QobjExperiment, QobjConfig, QobjHeader
-from ._random_qasm_generator import RandomQasmGenerator
 from .common import QiskitTestCase
 
 
@@ -65,14 +62,13 @@ def test_unitary_simulator(self):
                                     expected,
                                     rtol=1e-3))
 
-    def test_two_unitary_simulator(self):
-        """test running two circuits
+    def test_local_unitary_simulator(self):
+        """Test unitary simulator.
 
-        This test is similar to one in test_quantumprogram but doesn't use
-        multiprocessing.
+        If all correct should return the hxh and cx.
         """
         qr = QuantumRegister(2)
-        cr = ClassicalRegister(1)
+        cr = ClassicalRegister(2)
         qc1 = QuantumCircuit(qr, cr)
         qc2 = QuantumCircuit(qr, cr)
         qc1.h(qr)
@@ -92,37 +88,31 @@ def test_two_unitary_simulator(self):
         self.assertAlmostEqual(norm1, 4)
         self.assertAlmostEqual(norm2, 4)
 
-    def profile_unitary_simulator(self):
-        """Profile randomly generated circuits.
-
-        Writes profile results to <this_module>.prof as well as recording
-        to the log file.
+    def test_local_unitary_simulator_single_thread(self):
+        """test running two circuits
 
-        number of circuits = 100.
-        number of operations/circuit in [1, 40]
-        number of qubits in [1, 5]
+        Identical to the above test, but does not use multiprocessing.
         """
-        n_circuits = 100
-        max_depth = 40
-        max_qubits = 5
-        profile = cProfile.Profile()
-        random_circuits = RandomQasmGenerator(seed=self.seed,
-                                              max_depth=max_depth,
-                                              max_qubits=max_qubits)
-        random_circuits.add_circuits(n_circuits, do_measure=False)
-        qprogram = random_circuits.get_program()
-        profile.enable()
-        qprogram.execute(qprogram.get_circuit_names(),
-                         backend=UnitarySimulatorPy())
-        profile.disable()
-        sout = io.StringIO()
-        profile_stats = pstats.Stats(profile, stream=sout).sort_stats('cumulative')
-        self.log.info('------- start profiling UnitarySimulatorPy -----------')
-        profile_stats.print_stats()
-        self.log.info(sout.getvalue())
-        self.log.info('------- stop profiling UnitarySimulatorPy -----------')
-        sout.close()
-        profile.dump_stats(self.moduleName + '.prof')
+        qr = QuantumRegister(2)
+        cr = ClassicalRegister(1)
+        qc1 = QuantumCircuit(qr, cr)
+        qc2 = QuantumCircuit(qr, cr)
+        qc1.h(qr)
+        qc2.cx(qr[0], qr[1])
+        backend = UnitarySimulatorPy()
+        qobj = compile([qc1, qc2], backend=backend)
+        job = backend.run(qobj)
+        unitary1 = job.result().get_unitary(qc1)
+        unitary2 = job.result().get_unitary(qc2)
+        unitaryreal1 = np.array([[0.5, 0.5, 0.5, 0.5], [0.5, -0.5, 0.5, -0.5],
+                                 [0.5, 0.5, -0.5, -0.5],
+                                 [0.5, -0.5, -0.5, 0.5]])
+        unitaryreal2 = np.array([[1, 0, 0, 0], [0, 0, 0, 1],
+                                 [0., 0, 1, 0], [0, 1, 0, 0]])
+        norm1 = np.trace(np.dot(np.transpose(np.conj(unitaryreal1)), unitary1))
+        norm2 = np.trace(np.dot(np.transpose(np.conj(unitaryreal2)), unitary2))
+        self.assertAlmostEqual(norm1, 4)
+        self.assertAlmostEqual(norm2, 4)
 
 
 if __name__ == '__main__':
diff --git a/test/python/test_unroller.py b/test/python/test_unroller.py
--- a/test/python/test_unroller.py
+++ b/test/python/test_unroller.py
@@ -5,12 +5,11 @@
 # This source code is licensed under the Apache License, Version 2.0 found in
 # the LICENSE.txt file in the root directory of this source tree.
 
-# pylint: disable=missing-docstring
+"""Test Qiskit Unroller class."""
 
 from sys import version_info
 import unittest
 
-from qiskit import QuantumProgram
 from qiskit import qasm
 from qiskit.unroll import Unroller, DagUnroller, DAGBackend, JsonBackend
 from .common import QiskitTestCase
@@ -21,12 +20,12 @@ class UnrollerTest(QiskitTestCase):
 
     def setUp(self):
         self.seed = 42
-        self.qprogram = QuantumProgram()
 
     @unittest.skipIf(version_info.minor == 5, "Python 3.5 dictionaries don't preserve \
                                                insertion order, so we need to skip this \
                                                test, until fixed")
     def test_execute(self):
+        """Test DagUnroller.execute()"""
         ast = qasm.Qasm(filename=self._get_resource_path('qasm/example.qasm')).parse()
         dag_circuit = Unroller(ast, DAGBackend()).execute()
         dag_unroller = DagUnroller(dag_circuit,
@@ -58,6 +57,7 @@ def test_execute(self):
                                                insertion order, so we need to skip this \
                                                test, until fixed")
     def test_execute_with_basis(self):
+        """Test unroller.execute() to a gate basis."""
         ast = qasm.Qasm(filename=self._get_resource_path('qasm/example.qasm')).parse()
         dag_circuit = Unroller(ast, DAGBackend(["cx", "u1", "u2", "u3"])).execute()
         dag_unroller = DagUnroller(dag_circuit,
@@ -94,6 +94,7 @@ def test_execute_with_basis(self):
         self.assertEqual(unroller_dag_circuit.qasm(), expected_result)
 
     def test_expand_gates(self):
+        """Test DagUnroller.expand_gates()"""
         ast = qasm.Qasm(filename=self._get_resource_path('qasm/example.qasm')).parse()
         dag_circuit = Unroller(ast, DAGBackend()).execute()
         dag_unroller = DagUnroller(dag_circuit, DAGBackend())
@@ -121,6 +122,7 @@ def test_expand_gates(self):
         self.assertEqual(expanded_dag_circuit.qasm(), expected_result)
 
     def test_expand_gates_with_basis(self):
+        """Test DagUnroller.expand_gates() to a gate basis."""
         ast = qasm.Qasm(filename=self._get_resource_path('qasm/example.qasm')).parse()
         dag_circuit = Unroller(ast, DAGBackend(["cx", "u1", "u2", "u3"])).execute()
         dag_unroller = DagUnroller(dag_circuit, DAGBackend())
@@ -160,6 +162,7 @@ def test_expand_gates_with_basis(self):
     # them usually fails.
     @unittest.skip("Temporary skipping")
     def test_from_dag_to_json(self):
+        """Test DagUnroller with JSON backend."""
         ast = qasm.Qasm(filename=self._get_resource_path('qasm/example.qasm')).parse()
         dag_circuit = Unroller(ast, DAGBackend()).execute()
         dag_unroller = DagUnroller(dag_circuit, JsonBackend())
@@ -199,6 +202,7 @@ def test_from_dag_to_json(self):
     # them usually fails.
     @unittest.skip("Temporary skipping")
     def test_from_dag_to_json_with_basis(self):
+        """Test DagUnroller with JSON backend and a basis."""
         ast = qasm.Qasm(filename=self._get_resource_path('qasm/example.qasm')).parse()
         dag_circuit = Unroller(ast, DAGBackend(["cx", "u1", "u2", "u3"])).execute()
         dag_unroller = DagUnroller(dag_circuit, JsonBackend(["cx", "u1", "u2", "u3"]))
diff --git a/test/python/test_visualization.py b/test/python/test_visualization.py
--- a/test/python/test_visualization.py
+++ b/test/python/test_visualization.py
@@ -78,6 +78,7 @@ def random_circuit(self, width=3, depth=3, max_operands=3):
         return qc
 
     def test_tiny_circuit(self):
+        """Test draw tiny circuit."""
         filename = self._get_resource_path('test_tiny.tex')
         qc = self.random_circuit(1, 1, 1)
         try:
@@ -88,6 +89,7 @@ def test_tiny_circuit(self):
                 os.remove(filename)
 
     def test_normal_circuit(self):
+        """Test draw normal size circuit."""
         filename = self._get_resource_path('test_normal.tex')
         qc = self.random_circuit(5, 5, 3)
         try:
@@ -98,6 +100,7 @@ def test_normal_circuit(self):
                 os.remove(filename)
 
     def test_wide_circuit(self):
+        """Test draw wide circuit."""
         filename = self._get_resource_path('test_wide.tex')
         qc = self.random_circuit(100, 1, 1)
         try:
@@ -108,6 +111,7 @@ def test_wide_circuit(self):
                 os.remove(filename)
 
     def test_deep_circuit(self):
+        """Test draw deep circuit."""
         filename = self._get_resource_path('test_deep.tex')
         qc = self.random_circuit(1, 100, 1)
         try:
@@ -118,6 +122,7 @@ def test_deep_circuit(self):
                 os.remove(filename)
 
     def test_huge_circuit(self):
+        """Test draw huge circuit."""
         filename = self._get_resource_path('test_huge.tex')
         qc = self.random_circuit(40, 40, 1)
         try:
@@ -128,6 +133,7 @@ def test_huge_circuit(self):
                 os.remove(filename)
 
     def test_teleport(self):
+        """Test draw teleport circuit."""
         filename = self._get_resource_path('test_teleport.tex')
         qr = qiskit.QuantumRegister(3, 'q')
         cr = qiskit.ClassicalRegister(3, 'c')
diff --git a/test/python/test_wrapper.py b/test/python/test_wrapper.py
--- a/test/python/test_wrapper.py
+++ b/test/python/test_wrapper.py
@@ -50,8 +50,8 @@ def test_backends_with_filter(self, qe_token, qe_url):
         self.assertTrue(len(backends) > 0)
 
     def test_local_backends(self):
-        """Test wrapper.local_backends(filter=...)."""
-        local_backends = qiskit.wrapper.local_backends()
+        """Test wrapper.available_backends({'local': True})"""
+        local_backends = qiskit.wrapper.available_backends({'local': True})
         self.log.info(local_backends)
         self.assertTrue(len(local_backends) > 0)