diff --git a/ariths_gen/multi_bit_circuits/others/popcount.py b/ariths_gen/multi_bit_circuits/others/popcount.py index 04fcda3..4721bce 100644 --- a/ariths_gen/multi_bit_circuits/others/popcount.py +++ b/ariths_gen/multi_bit_circuits/others/popcount.py @@ -1,7 +1,7 @@ """ """ -from typing import Union +from typing import Union, Optional from ariths_gen.wire_components import ( Wire, @@ -45,7 +45,7 @@ class UnsignedPopCount(GeneralCircuit): """ - def __init__(self, a: Bus, adder : Union[ArithmeticCircuit, None] = None, prefix : str = "", name : str = "popcnt", **kwargs): + def __init__(self, a: Bus, adder : Optional[ArithmeticCircuit] = None, prefix : str = "", name : str = "popcnt", **kwargs): self.N = a.N self.a = a diff --git a/tests/test_popcnt.py b/tests/test_popcnt.py index 52de63f..a877254 100644 --- a/tests/test_popcnt.py +++ b/tests/test_popcnt.py @@ -1,3 +1,4 @@ +from io import StringIO from ariths_gen.core.cgp_circuit import UnsignedCGPCircuit from ariths_gen.wire_components import ( Wire, @@ -11,6 +12,7 @@ from ariths_gen.core.arithmetic_circuits import GeneralCircuit from ariths_gen.multi_bit_circuits.others import ( UnsignedPopCount ) +import numpy as np def test_popcount():