diff options
| author | J08nY | 2023-02-12 19:05:28 +0100 |
|---|---|---|
| committer | J08nY | 2023-02-12 19:05:28 +0100 |
| commit | 7421fce192b581d732eabf4b2948bd8546b4afea (patch) | |
| tree | 486ccd2159e049a96607cef832841f463ef6e56c /test | |
| parent | 7c3b286a78a294a0eb6cd052682b9ee92420fa4d (diff) | |
| download | pyecsca-7421fce192b581d732eabf4b2948bd8546b4afea.tar.gz pyecsca-7421fce192b581d732eabf4b2948bd8546b4afea.tar.zst pyecsca-7421fce192b581d732eabf4b2948bd8546b4afea.zip | |
Get rid of getcontext/setcontext functions.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ec/test_context.py | 15 | ||||
| -rw-r--r-- | test/sca/test_rpa.py | 1 | ||||
| -rw-r--r-- | test/utils.py | 2 |
3 files changed, 5 insertions, 13 deletions
diff --git a/test/ec/test_context.py b/test/ec/test_context.py index 6691985..9cd74a3 100644 --- a/test/ec/test_context.py +++ b/test/ec/test_context.py @@ -3,12 +3,8 @@ from unittest import TestCase from pyecsca.ec.context import ( local, DefaultContext, - NullContext, - getcontext, - setcontext, - resetcontext, Tree, - PathContext, + PathContext ) from pyecsca.ec.key_generation import KeyGeneration from pyecsca.ec.params import get_params @@ -68,18 +64,14 @@ class ContextTests(TestCase): def test_null(self): with local() as ctx: self.mult.multiply(59) - self.assertIsInstance(ctx, NullContext) + self.assertIs(ctx, None) def test_default(self): - token = setcontext(DefaultContext()) - self.addCleanup(resetcontext, token) - with local(DefaultContext()) as ctx: result = self.mult.multiply(59) self.assertEqual(len(ctx.actions), 1) action = next(iter(ctx.actions.keys())) self.assertIsInstance(action, ScalarMultiplicationAction) - self.assertEqual(len(getcontext().actions), 0) self.assertEqual(result, action.result) def test_default_no_enter(self): @@ -100,6 +92,5 @@ class ContextTests(TestCase): self.mult.multiply(59) str(default) str(default.actions) - with local(NullContext()) as null: + with local(None): self.mult.multiply(59) - str(null) diff --git a/test/sca/test_rpa.py b/test/sca/test_rpa.py index 995099d..325d796 100644 --- a/test/sca/test_rpa.py +++ b/test/sca/test_rpa.py @@ -3,6 +3,7 @@ from unittest import TestCase from parameterized import parameterized from pyecsca.ec.context import local +from pyecsca.ec import context from pyecsca.ec.mult import ( LTRMultiplier, BinaryNAFMultiplier, diff --git a/test/utils.py b/test/utils.py index d4893eb..e125813 100644 --- a/test/utils.py +++ b/test/utils.py @@ -62,7 +62,7 @@ class Profiler: if self._state != "out": raise ValueError if self._prof_type == "py": - print(self._prof.output_text(unicode=True, color=True)) + print(self._prof.output_text(unicode=True, color=True, show_all=True)) else: self._prof.print_stats("cumtime") |
