From ed1b75feb2e82017c3d822372e95fe330fb74c3e Mon Sep 17 00:00:00 2001 From: Makman2 Date: Sun, 14 Jan 2018 03:26:46 +0100 Subject: [PATCH] tests: Add test for invalid opening-modes ... for MemoryView. Increases code coverage. Related to https://github.com/Makman2/memaccess/issues/19 --- tests/test_MemoryView.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_MemoryView.py b/tests/test_MemoryView.py index b705d31..251e1b8 100644 --- a/tests/test_MemoryView.py +++ b/tests/test_MemoryView.py @@ -106,6 +106,13 @@ def test_double_close(read_test_process): assert str(ex.value) == expected_message +def test_invalid_mode(read_test_process): + with pytest.raises(ValueError) as ex: + MemoryView(read_test_process.pid, 'rwx') + + assert str(ex.value) == 'Invalid access mode: rwx' + + def test_read_int(read_test_process): field = next(v for v in read_test_process.values if v.type == 'int')