Skip to content

Commit

Permalink
fix testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dakk committed Nov 16, 2023
1 parent 9cfccc2 commit 6444603
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion qlasskit/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _full_adder(c, a, b): # Carry x Sum

def const_to_qtype(value: Any) -> TExp:
if isinstance(value, int):
for det_type in [Qint2, Qint3, Qint4, Qint8, Qint12, Qint16]:
for det_type in [Qint2, Qint4, Qint8, Qint12, Qint16]: # Qint3
if value < 2**det_type.BIT_SIZE:
return det_type.const(value)

Expand Down
10 changes: 5 additions & 5 deletions test/test_qlassf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ def test_debug_optimizer(self):

@parameterized_class(("compiler"), ENABLED_COMPILERS)
class TestQlassfCustomTypes(unittest.TestCase):
def test_custom_qint3(self):
def test_custom_qint5(self):
qf = qlassf(
utils.test_qint3,
types=[utils.Qint3],
utils.test_qint5,
types=[utils.Qint5],
to_compile=COMPILATION_ENABLED,
compiler=self.compiler,
)
compute_and_compare_results(self, qf)

def test_custom_qint3_notfound(self):
def test_custom_qint5_notfound(self):
self.assertRaises(
exceptions.UnknownTypeException,
lambda f: qlassf(
f, types=[], to_compile=COMPILATION_ENABLED, compiler=self.compiler
),
utils.test_qint3,
utils.test_qint5,
)


Expand Down
6 changes: 3 additions & 3 deletions test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ def test_not(a: bool) -> bool:
return not a


class Qint3(Qint):
BIT_SIZE = 3
class Qint5(Qint):
BIT_SIZE = 5


def test_qint3(a: Qint3) -> bool:
def test_qint5(a: Qint5) -> bool:
return not a[0]


Expand Down

0 comments on commit 6444603

Please sign in to comment.