def test_mapping(self):
        """ Test mapping to qubit operator """
        driver = HDF5Driver(hdf5_input=self.get_resource_path('test_driver_hdf5.hdf5',
                                                              'drivers/hdf5d'))
        q_molecule = driver.run()
        fermionic_op = fermionic_op_builder._build_fermionic_op(q_molecule)
        mapper = JordanWignerMapper()
        qubit_op = mapper.map(fermionic_op)

        # Note: The PauliSumOp equals, as used in the test below, use the equals of the
        #       SparsePauliOp which in turn uses np.allclose() to determine equality of
        #       coeffs. So the reference operator above will be matched on that basis so
        #       we don't need to worry about tiny precision changes for any reason.

        self.assertEqual(qubit_op, TestJordanWignerMapper.REF_H2)
    def test_mapping(self):
        """Test mapping to qubit operator"""
        driver = HDF5Driver(hdf5_input=self.get_resource_path(
            "test_driver_hdf5.hdf5", "drivers/second_quantization/hdf5d"))
        driver_result = driver.run()
        fermionic_op = driver_result.second_q_ops()["ElectronicEnergy"]
        mapper = JordanWignerMapper()
        qubit_op = mapper.map(fermionic_op)

        # Note: The PauliSumOp equals, as used in the test below, use the equals of the
        #       SparsePauliOp which in turn uses np.allclose() to determine equality of
        #       coeffs. So the reference operator above will be matched on that basis so
        #       we don't need to worry about tiny precision changes for any reason.

        self.assertEqual(qubit_op, TestJordanWignerMapper.REF_H2)