diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2019-07-28 22:58:04 -0400 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2019-07-28 21:58:04 -0500 |
commit | 9cd41ac714d9bff819ece6d8cdcde064d403c671 (patch) | |
tree | 4ed2502ced1db85417fbf6fe214f59a1525893ff /tests/hazmat | |
parent | 2c83570f6310cb36553af274eb41dd8e2b96b58e (diff) | |
download | cryptography-9cd41ac714d9bff819ece6d8cdcde064d403c671.tar.gz cryptography-9cd41ac714d9bff819ece6d8cdcde064d403c671.tar.bz2 cryptography-9cd41ac714d9bff819ece6d8cdcde064d403c671.zip |
Make DER reader into a context manager (#4957)
* Make DER reader into a context manager
* Added another test case
* flake8
Diffstat (limited to 'tests/hazmat')
-rw-r--r-- | tests/hazmat/test_der.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/hazmat/test_der.py b/tests/hazmat/test_der.py index d81c0d3e..d052802c 100644 --- a/tests/hazmat/test_der.py +++ b/tests/hazmat/test_der.py @@ -46,6 +46,14 @@ def test_der(): with pytest.raises(ValueError): reader.check_empty() + with pytest.raises(ValueError): + with reader: + pass + + with pytest.raises(ZeroDivisionError): + with DERReader(der): + raise ZeroDivisionError + # Parse the outer element. outer = reader.read_element(SEQUENCE) reader.check_empty() |