def test_none_r(bs): stream = bio(bs) assert rw.none().read(stream) is None stream.read() == 'a b c' assert rw.none().width() == 0
def test_none_w(): stream = BytesIO() assert rw.none().write(42, stream) == stream assert stream.getvalue() == ''
def test_none_r(bs): stream = bio(bs) assert rw.none().read(stream) is None stream.read() == 'a b c' assert rw.none().width() == 0 def test_none_w(): stream = BytesIO() assert rw.none().write(42, stream) == stream assert stream.getvalue() == '' @pytest.mark.parametrize('other, bs', [ (rw.none(), []), (rw.number(1), [1]), (rw.number(4), [1, 2, 3, 4]), ]) def test_constant_r(other, bs): stream = bio(bs) assert rw.constant(other, 42).read(stream) == 42 assert stream.read() == '' assert rw.constant(other, 42).width() == other.width() @pytest.mark.parametrize('other, v1, v2', [ (rw.none(), None, None), (rw.number(1), 10, 12), (rw.number(2), 500, 1),