aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hazmat')
-rw-r--r--tests/hazmat/primitives/test_ec.py43
1 files changed, 13 insertions, 30 deletions
diff --git a/tests/hazmat/primitives/test_ec.py b/tests/hazmat/primitives/test_ec.py
index 59e4c995..5c3da5b6 100644
--- a/tests/hazmat/primitives/test_ec.py
+++ b/tests/hazmat/primitives/test_ec.py
@@ -142,43 +142,26 @@ def test_ec_numbers():
assert numbers.public_numbers.y == 3
assert isinstance(numbers.public_numbers.curve, DummyCurve)
- with pytest.raises(TypeError):
- ec.EllipticCurvePrivateNumbers(
- None,
- ec.EllipticCurvePublicNumbers(
- 2, 3, DummyCurve()
- )
- )
-
- with pytest.raises(TypeError):
- ec.EllipticCurvePrivateNumbers(
- 1,
- ec.EllipticCurvePublicNumbers(
- None, 3, DummyCurve()
- )
- )
+@pytest.mark.parametrize(
+ ("private_value", "x", "y", "curve"),
+ [
+ (None, 2, 3, DummyCurve()),
+ (1, None, 3, DummyCurve()),
+ (1, 2, None, DummyCurve()),
+ (1, 2, 3, None),
+ ]
+)
+def test_invalid_ec_numbers_args(private_value, x, y, curve):
with pytest.raises(TypeError):
ec.EllipticCurvePrivateNumbers(
- 1,
- ec.EllipticCurvePublicNumbers(
- 2, None, DummyCurve()
- )
+ private_value, ec.EllipticCurvePublicNumbers(x, y, curve)
)
- with pytest.raises(TypeError):
- ec.EllipticCurvePrivateNumbers(
- 1,
- ec.EllipticCurvePublicNumbers(
- 2, 3, None
- )
- )
+def test_invalid_private_numbers_public_numbers():
with pytest.raises(TypeError):
- ec.EllipticCurvePrivateNumbers(
- 1,
- None
- )
+ ec.EllipticCurvePrivateNumbers(1, None)
def test_encode_point():