From 6fcfde015b74257f848eca67f564ff60ef3e4661 Mon Sep 17 00:00:00 2001 From: J08nY Date: Sat, 8 Mar 2025 19:49:21 +0100 Subject: Fix codestyle. --- test/ec/test_context.py | 16 +++++++++------- test/sca/test_rpa.py | 8 ++++++-- 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/ec/test_context.py b/test/ec/test_context.py index f76995b..e82f852 100644 --- a/test/ec/test_context.py +++ b/test/ec/test_context.py @@ -1,11 +1,6 @@ import pytest -from pyecsca.ec.context import ( - local, - DefaultContext, - Node, - PathContext, Action -) +from pyecsca.ec.context import local, DefaultContext, Node, PathContext, Action from pyecsca.ec.key_generation import KeyGeneration from pyecsca.ec.mod import RandomModAction from pyecsca.ec.mult import LTRMultiplier, ScalarMultiplicationAction @@ -51,10 +46,13 @@ def test_render(): Node(other_a, parent=a) txt = tree.render() - assert txt == """Action() + assert ( + txt + == """Action() └──Action() ├──Action() └──Action()""" + ) @pytest.fixture() @@ -89,6 +87,7 @@ def test_default_no_enter(): with local(DefaultContext()) as default, pytest.raises(ValueError): default.exit_action(RandomModAction(7)) + def test_multiple_enter(mult): default = DefaultContext() with local(default) as ctx1: @@ -100,6 +99,7 @@ def test_multiple_enter(mult): assert len(default.actions) == 0 assert len(ctx1.actions) == len(ctx2.actions) + def test_multiple_enter_chained(mult): default = DefaultContext() with local(default) as ctx1: @@ -111,6 +111,7 @@ def test_multiple_enter_chained(mult): assert len(default.actions) == 0 assert 2 * len(ctx1.actions) == len(ctx2.actions) + def test_multiple_enter_no_copy(mult): default = DefaultContext() with local(default, copy=False) as ctx1: @@ -122,6 +123,7 @@ def test_multiple_enter_no_copy(mult): assert len(default.actions) == len(ctx1.actions) assert len(ctx1.actions) == len(ctx2.actions) + def test_path(mult, secp128r1): with local(PathContext([0, 1])) as ctx: key_generator = KeyGeneration(mult, secp128r1, True) diff --git a/test/sca/test_rpa.py b/test/sca/test_rpa.py index 0d2860b..b17c6d4 100644 --- a/test/sca/test_rpa.py +++ b/test/sca/test_rpa.py @@ -28,7 +28,8 @@ from pyecsca.sca.re.rpa import ( MultipleContext, rpa_point_0y, rpa_point_x0, - rpa_distinguish, multiples_computed, + rpa_distinguish, + multiples_computed, ) @@ -72,11 +73,14 @@ def rpa_params(model, coords): def test_multiples(rpa_params): - multiples = multiples_computed(17, rpa_params, LTRMultiplier, LTRMultiplier, True, True) + multiples = multiples_computed( + 17, rpa_params, LTRMultiplier, LTRMultiplier, True, True + ) assert 1 in multiples assert 17 in multiples assert 0 not in multiples + def test_x0_point(rpa_params): res = rpa_point_x0(rpa_params) assert res is not None -- cgit v1.2.3-70-g09d2