diff options
| author | J08nY | 2024-04-16 15:38:09 +0200 |
|---|---|---|
| committer | J08nY | 2024-04-16 15:38:09 +0200 |
| commit | 483eebd0dd4aefb60552e701dfa13d747881dd63 (patch) | |
| tree | fbd62a1678975e6dd7d3595e2ae9a39dc775f363 /test | |
| parent | f57762f291bbd0de46c7a7f98135fd3e15827db2 (diff) | |
| download | pyecsca-483eebd0dd4aefb60552e701dfa13d747881dd63.tar.gz pyecsca-483eebd0dd4aefb60552e701dfa13d747881dd63.tar.zst pyecsca-483eebd0dd4aefb60552e701dfa13d747881dd63.zip | |
Fix DeepSourcce issues.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ec/test_divpoly.py | 8 | ||||
| -rw-r--r-- | test/ec/test_formula.py | 2 | ||||
| -rw-r--r-- | test/ec/test_params.py | 2 | ||||
| -rw-r--r-- | test/sca/test_plot.py | 1 | ||||
| -rw-r--r-- | test/sca/test_rpa.py | 12 | ||||
| -rw-r--r-- | test/sca/test_target.py | 6 |
6 files changed, 19 insertions, 12 deletions
diff --git a/test/ec/test_divpoly.py b/test/ec/test_divpoly.py index 84c780c..c3c4c1f 100644 --- a/test/ec/test_divpoly.py +++ b/test/ec/test_divpoly.py @@ -175,16 +175,16 @@ def test_mult_by_n_large(secp128r1): with files(test.data.divpoly).joinpath("mult_21.json").open("r") as f: sage_data = json.load(f) sage_data["mx"][0] = { - eval(key): K(val) for key, val in sage_data["mx"][0].items() + eval(key): K(val) for key, val in sage_data["mx"][0].items() # eval is OK here, skipcq: PYL-W0123 } sage_data["mx"][1] = { - eval(key): K(val) for key, val in sage_data["mx"][1].items() + eval(key): K(val) for key, val in sage_data["mx"][1].items() # eval is OK here, skipcq: PYL-W0123 } sage_data["my"][0] = { - eval(key): K(val) for key, val in sage_data["my"][0].items() + eval(key): K(val) for key, val in sage_data["my"][0].items() # eval is OK here, skipcq: PYL-W0123 } sage_data["my"][1] = { - eval(key): K(val) for key, val in sage_data["my"][1].items() + eval(key): K(val) for key, val in sage_data["my"][1].items() # eval is OK here, skipcq: PYL-W0123 } assert mx[0].as_dict() == sage_data["mx"][0] diff --git a/test/ec/test_formula.py b/test/ec/test_formula.py index 42835a9..24cdc7c 100644 --- a/test/ec/test_formula.py +++ b/test/ec/test_formula.py @@ -77,7 +77,7 @@ def test_inputs_outputs(add): def test_eq(add, dbl): - assert add == add + assert add.__eq__(add) assert add != dbl diff --git a/test/ec/test_params.py b/test/ec/test_params.py index 2163684..8ca7252 100644 --- a/test/ec/test_params.py +++ b/test/ec/test_params.py @@ -17,7 +17,7 @@ from pyecsca.ec.curve import EllipticCurve def test_eq(secp128r1, curve25519): - assert secp128r1 == secp128r1 + assert secp128r1.__eq__(secp128r1) assert secp128r1 != curve25519 assert secp128r1 is not None diff --git a/test/sca/test_plot.py b/test/sca/test_plot.py index 2722ba3..78e1098 100644 --- a/test/sca/test_plot.py +++ b/test/sca/test_plot.py @@ -39,6 +39,7 @@ def test_png(trace1, plot_path): save_figure_png(fig, str(plot_path())) +@pytest.mark.skip("Broken without some backend.") def test_svg(trace1, plot_path): hv.extension("matplotlib") fig = plot_trace(trace1) diff --git a/test/sca/test_rpa.py b/test/sca/test_rpa.py index af19ba2..0e22efa 100644 --- a/test/sca/test_rpa.py +++ b/test/sca/test_rpa.py @@ -1,6 +1,3 @@ -import io -from contextlib import redirect_stdout - import pytest from pyecsca.ec.context import local @@ -107,6 +104,15 @@ def test_distinguish(secp128r1, add, dbl, neg): WindowNAFMultiplier( add, dbl, neg, 5, None, AccumulationOrder.PeqPR, True, True ), + WindowBoothMultiplier( + add, dbl, neg, 3, None, AccumulationOrder.PeqPR, True, True + ), + WindowBoothMultiplier( + add, dbl, neg, 4, None, AccumulationOrder.PeqPR, True, True + ), + WindowBoothMultiplier( + add, dbl, neg, 5, None, AccumulationOrder.PeqPR, True, True + ), SlidingWindowMultiplier( add, dbl, 3, None, ProcessingDirection.LTR, AccumulationOrder.PeqPR, True ), diff --git a/test/sca/test_target.py b/test/sca/test_target.py index 6b8a8c7..a5a58e4 100644 --- a/test/sca/test_target.py +++ b/test/sca/test_target.py @@ -37,7 +37,7 @@ from pyecsca.sca.target.ectester import ( if has_pyscard: from pyecsca.sca.target.ectester import ECTesterTargetPCSC as ECTesterTarget else: - from pyecsca.sca.target.ectester import ECTesterTarget + from pyecsca.sca.target.ectester import ECTesterTarget # type: ignore class TestTarget(SimpleSerialTarget, BinaryTarget): @@ -98,8 +98,8 @@ def target(): pytest.skip(f"No reader found: {e}") if not rs: pytest.skip("No reader found") - reader = rs[0] - target: ECTesterTarget = ECTesterTarget(reader) + reader = rs[0] # type: ignore + target: ECTesterTarget = ECTesterTarget(reader) # This will not instantiate an abstract class, skipcq: PYL-E0110 target.connect() if not target.select_applet(): target.disconnect() |
