Skip to content

Commit

Permalink
add tests to test decoder plugin python interface
Browse files Browse the repository at this point in the history
Signed-off-by: Melody Ren <[email protected]>
  • Loading branch information
melody-ren committed Jan 6, 2025
1 parent 68cedd0 commit e515184
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions libs/qec/python/tests/test_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ def test_decoder_result_structure():
assert len(result.result) == 10


def test_decoder_plugin_initialization():
decoder = qec.get_decoder('single_error_lut_example', H)
assert decoder is not None
assert hasattr(decoder, 'decode')


def test_decoder_plugin_result_structure():
decoder = qec.get_decoder('single_error_lut_example', H)
result = decoder.decode(create_test_syndrome())

assert hasattr(result, 'converged')
assert hasattr(result, 'result')
assert isinstance(result.converged, bool)
assert isinstance(result.result, list)


def test_decoder_result_values():
decoder = qec.get_decoder('example_byod', H)
result = decoder.decode(create_test_syndrome())
Expand Down

0 comments on commit e515184

Please sign in to comment.