Skip to content

Commit 13398ee

Browse files
committed
Fix basedpyright issues after update
1 parent 5fa6760 commit 13398ee

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

tests/mcproto/protocol/test_base_io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def setup_class(cls):
179179
...
180180

181181
@pytest.fixture
182-
def method_mock(self) -> Mock | AsyncMock:
182+
def method_mock(self) -> type[Mock | AsyncMock]:
183183
"""Obtain the appropriate type of mock, supporting both sync and async modes."""
184184
if isinstance(cast("T_WRITER", self.writer), BaseSyncWriter):
185185
return Mock
@@ -394,7 +394,7 @@ def setup_class(cls):
394394
...
395395

396396
@pytest.fixture
397-
def method_mock(self) -> Mock | AsyncMock:
397+
def method_mock(self) -> type[Mock | AsyncMock]:
398398
"""Obtain the appropriate type of mock, supporting both sync and async modes."""
399399
if isinstance(cast("T_READER", self.reader), BaseSyncReader):
400400
return Mock

tests/mcproto/test_connection.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def test_read(self):
115115
out = conn.read(5)
116116

117117
assert out == data
118-
conn.socket._recv.assert_read_everything()
118+
conn.socket._recv.assert_read_everything() # pyright: ignore[reportPrivateUsage]
119119

120120
def test_read_more_data_than_sent(self):
121121
"""Test reading more data than available raises :exc:`IOError`."""
@@ -144,7 +144,7 @@ def test_write(self):
144144

145145
conn.write(data)
146146

147-
conn.socket._send.assert_has_data(data)
147+
conn.socket._send.assert_has_data(data) # pyright: ignore[reportPrivateUsage]
148148

149149
def test_encrypted_write(self):
150150
"""Test writing plaintext data with enabled encryption encrypts the data before sending."""
@@ -157,14 +157,14 @@ def test_encrypted_write(self):
157157
conn.enable_encryption(key)
158158

159159
conn.write(plaintext_data)
160-
conn.socket._send.assert_has_data(encrypted_data)
160+
conn.socket._send.assert_has_data(encrypted_data) # pyright: ignore[reportPrivateUsage]
161161

162162
def test_socket_close(self):
163163
"""Test close method closes the underlying socket."""
164164
conn = self.make_connection()
165165

166166
conn.close()
167-
assert conn.socket._closed is True
167+
assert conn.socket._closed is True # pyright: ignore[reportPrivateUsage]
168168

169169
def test_socket_close_contextmanager(self):
170170
"""Test using connection as context manager closes the underlying socket afterwards."""
@@ -174,7 +174,7 @@ def test_socket_close_contextmanager(self):
174174
pass
175175

176176
# Internal socket gets closed once context manager is exited
177-
assert conn.socket._closed is True
177+
assert conn.socket._closed is True # pyright: ignore[reportPrivateUsage]
178178

179179
# Can't reopen closed connection
180180
with pytest.raises(OSError): # noqa: SIM117
@@ -203,7 +203,7 @@ async def test_read(self):
203203
out = await conn.read(5)
204204

205205
assert out == data
206-
conn.reader._read.assert_read_everything()
206+
conn.reader._read.assert_read_everything() # pyright: ignore[reportPrivateUsage]
207207

208208
async def test_read_more_data_than_sent(self):
209209
"""Test reading more data than available raises :exc:`IOError`."""
@@ -232,7 +232,7 @@ async def test_write(self):
232232

233233
await conn.write(data)
234234

235-
conn.writer._write.assert_has_data(data)
235+
conn.writer._write.assert_has_data(data) # pyright: ignore[reportPrivateUsage]
236236

237237
async def test_encrypted_write(self):
238238
"""Test writing plaintext data with enabled encryption encrypts the data before sending."""
@@ -245,14 +245,14 @@ async def test_encrypted_write(self):
245245
conn.enable_encryption(key)
246246

247247
await conn.write(plaintext_data)
248-
conn.writer._write.assert_has_data(encrypted_data)
248+
conn.writer._write.assert_has_data(encrypted_data) # pyright: ignore[reportPrivateUsage]
249249

250250
async def test_socket_close(self):
251251
"""Test close method closes the underlying socket."""
252252
conn = self.make_connection()
253253

254254
await conn.close()
255-
assert conn.writer._closed is True
255+
assert conn.writer._closed is True # pyright: ignore[reportPrivateUsage]
256256

257257
async def test_socket_close_contextmanager(self):
258258
"""Test using connection as context manager closes the underlying socket afterwards."""
@@ -262,7 +262,7 @@ async def test_socket_close_contextmanager(self):
262262
pass
263263

264264
# Internal writer gets closed once context manager is exited
265-
assert conn.writer._closed is True
265+
assert conn.writer._closed is True # pyright: ignore[reportPrivateUsage]
266266

267267
# Can't reopen closed connection
268268
with pytest.raises(OSError):

0 commit comments

Comments
 (0)