Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 39b9225

Browse files
Lorak-mmkdkropachev
authored andcommitted
bytesio_testhelper: Remove assert_raises argument
1 parent 83671d8 commit 39b9225

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

‎tests/unit/cython/bytesio_testhelper.pyx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,27 @@
1313
# limitations under the License.
1414

1515
from cassandra.bytesio cimport BytesIOReader
16+
import pytest
1617

17-
def test_read1(assert_raises):
18+
def test_read1():
1819
cdef BytesIOReader reader = BytesIOReader(b'abcdef')
1920
assert reader.read(2)[:2] == b'ab'
2021
assert reader.read(2)[:2] == b'cd'
2122
assert reader.read(0)[:0] == b''
2223
assert reader.read(2)[:2] == b'ef'
2324

24-
def test_read2(assert_raises):
25+
def test_read2():
2526
cdef BytesIOReader reader = BytesIOReader(b'abcdef')
2627
reader.read(5)
2728
reader.read(1)
2829

29-
def test_read3(assert_raises):
30+
def test_read3():
3031
cdef BytesIOReader reader = BytesIOReader(b'abcdef')
3132
reader.read(6)
3233

33-
def test_read_eof(assert_raises):
34+
def test_read_eof():
3435
cdef BytesIOReader reader = BytesIOReader(b'abcdef')
3536
reader.read(5)
36-
# cannot convert reader.read to an object, do it manually
37-
# assert_raises(EOFError, reader.read, 2)
38-
try:
37+
with pytest.raises(EOFError):
3938
reader.read(2)
40-
except EOFError:
41-
pass
42-
else:
43-
raise Exception("Expected an EOFError")
4439
reader.read(1) # see that we can still read this

‎tests/unit/cython/test_bytesio.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class BytesIOTest(unittest.TestCase):
2323

2424
@cythontest
2525
def test_reading(self):
26-
bytesio_testhelper.test_read1(self.assertRaises)
27-
bytesio_testhelper.test_read2(self.assertRaises)
28-
bytesio_testhelper.test_read3(self.assertRaises)
26+
bytesio_testhelper.test_read1()
27+
bytesio_testhelper.test_read2()
28+
bytesio_testhelper.test_read3()
2929

3030
@cythontest
3131
def test_reading_error(self):
32-
bytesio_testhelper.test_read_eof(self.assertRaises)
32+
bytesio_testhelper.test_read_eof()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /