From 7f3914b478e8b4fcd6ed0e68a272649bbb1c627d Mon Sep 17 00:00:00 2001 From: lymanZerga11 Date: Mon, 30 Jan 2017 14:58:45 +0800 Subject: Patch up easy TypeError-based coverage gaps (#598) --- tests/test_rand.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/test_rand.py b/tests/test_rand.py index 7574412..ac3965b 100644 --- a/tests/test_rand.py +++ b/tests/test_rand.py @@ -19,8 +19,8 @@ from .util import NON_ASCII class TestRand(object): @pytest.mark.parametrize('args', [ - (None), - (b"foo"), + (None,), + (b"foo",), ]) def test_bytes_wrong_args(self, args): """ @@ -73,8 +73,8 @@ class TestRand(object): rand.add(b'hamburger', 3) @pytest.mark.parametrize('args', [ - (None), - (42), + (None,), + (42,), ]) def test_seed_wrong_args(self, args): """ @@ -110,6 +110,18 @@ class TestRand(object): """ pytest.deprecated_call(rand.egd, *args) + @pytest.mark.parametrize('args', [ + (None, 255), + (b"foo", None), + ]) + def test_egd_wrong_args(self, args): + """ + `OpenSSL.rand.egd` raises `TypeError` if called with a non-`int` + or non-`str` argument. + """ + with pytest.raises(TypeError): + rand.egd(*args) + def test_cleanup(self): """ `OpenSSL.rand.cleanup` releases the memory used by the PRNG and -- cgit v1.2.1