Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
kt474 committed Dec 19, 2024
1 parent 436e340 commit fc15f6c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/unit/test_local_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from qiskit.primitives.containers.data_bin import DataBin

from qiskit_ibm_runtime.fake_provider import FakeManilaV2
from qiskit_ibm_runtime.fake_provider.local_runtime_job import LocalRuntimeJob
from qiskit_ibm_runtime import (
Session,
Batch,
Expand Down Expand Up @@ -160,3 +161,18 @@ def test_non_primitive(self, backend):
session = Session(backend=backend)
with self.assertRaisesRegex(ValueError, "Only sampler and estimator"):
session._run(program_id="foo", inputs={})


class TestLocalRuntimeJob(IBMTestCase):
"""Class for testing local mode runtime jobs."""

def test_v2_sampler(self):
"""Test V2 Sampler on a local backend."""
inst = SamplerV2(mode=FakeManilaV2())
job = inst.run(**get_primitive_inputs(inst))

self.assertIsInstance(job, LocalRuntimeJob)
self.assertTrue(job.metrics())
self.assertTrue(job.backend())
self.assertTrue(job.inputs)
self.assertEqual(job.usage(), 0)

0 comments on commit fc15f6c

Please sign in to comment.