diff options
| author | J08nY | 2019-04-24 19:26:11 +0200 |
|---|---|---|
| committer | J08nY | 2019-04-24 19:26:11 +0200 |
| commit | 2a109ad4502bc7983c9fd4fc29a62b6f028762b0 (patch) | |
| tree | ab0074015d3e2008fa0071efbfb49f2c224e78c7 /test/ec/test_context.py | |
| parent | f4bcb085cfc9ddac71fe8bb82e8f6719309b2637 (diff) | |
| download | pyecsca-2a109ad4502bc7983c9fd4fc29a62b6f028762b0.tar.gz pyecsca-2a109ad4502bc7983c9fd4fc29a62b6f028762b0.tar.zst pyecsca-2a109ad4502bc7983c9fd4fc29a62b6f028762b0.zip | |
Diffstat (limited to 'test/ec/test_context.py')
| -rw-r--r-- | test/ec/test_context.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/ec/test_context.py b/test/ec/test_context.py index 9e56afb..1073fc0 100644 --- a/test/ec/test_context.py +++ b/test/ec/test_context.py @@ -1,7 +1,9 @@ import ast from unittest import TestCase -from pyecsca.ec.context import local, DefaultContext, OpResult, NullContext, getcontext +from pyecsca.ec.context import (local, DefaultContext, OpResult, NullContext, getcontext, + setcontext, + resetcontext) from pyecsca.ec.coordinates import AffineCoordinateModel from pyecsca.ec.mod import Mod from pyecsca.ec.mult import LTRMultiplier @@ -33,9 +35,13 @@ class ContextTests(TestCase): self.assertIsInstance(ctx, NullContext) def test_default(self): + token = setcontext(DefaultContext()) + self.addCleanup(resetcontext, token) + with local(DefaultContext()) as ctx: self.mult.multiply(59, self.base) self.assertEqual(len(ctx.actions), 10) + self.assertEqual(len(getcontext().actions), 0) def test_execute(self): with self.assertRaises(ValueError): |
