Skip to content

Commit e9ef42a

Browse files
committed
Tests for empty buffers.
1 parent ada6522 commit e9ef42a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test_socket.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ def test_recvmsg_into():
5353
assert buf[: len(test_data)] == test_data
5454

5555

56+
def test_recvmsg_into_empty_buffers():
57+
sock = MocketSocket(socket.AF_INET, socket.SOCK_STREAM)
58+
result = sock.recvmsg_into([])
59+
assert result == 0
60+
61+
5662
def test_accept():
5763
sock = MocketSocket(socket.AF_INET, socket.SOCK_STREAM)
5864
sock._host = "127.0.0.1"
@@ -78,3 +84,9 @@ def test_sendmsg():
7884
total_sent = sock.sendmsg(msg)
7985
assert total_sent == sum(len(m) for m in msg)
8086
assert Mocket.last_request() == b"".join(msg)
87+
88+
89+
def test_sendmsg_empty_buffers():
90+
sock = MocketSocket(socket.AF_INET, socket.SOCK_STREAM)
91+
result = sock.sendmsg([])
92+
assert result == 0

0 commit comments

Comments
 (0)