From: Mohammad Reza <34370960+azibom@users.noreply.github.com> Date: Sun, 24 May 2026 14:20:55 +0000 (+0330) Subject: gh-150315: increase test coverage for `asyncio._FlowControlMixin.set_write_buffer_lim... X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=cb72193c8c48a29c6f877863684b9f56f095c7c3;p=thirdparty%2FPython%2Fcpython.git gh-150315: increase test coverage for `asyncio._FlowControlMixin.set_write_buffer_limits` (#150317) --- diff --git a/Lib/test/test_asyncio/test_transports.py b/Lib/test/test_asyncio/test_transports.py index dbb572e2e153..1781f1f67753 100644 --- a/Lib/test/test_asyncio/test_transports.py +++ b/Lib/test/test_asyncio/test_transports.py @@ -98,6 +98,26 @@ class TransportTests(unittest.TestCase): self.assertTrue(transport._protocol_paused) self.assertEqual(transport.get_write_buffer_limits(), (128, 256)) + def test_flowcontrol_mixin_compute_write_limits(self): + + class MyTransport(transports._FlowControlMixin, + transports.Transport): + + def get_write_buffer_size(self): + return 0 + + loop = mock.Mock() + transport = MyTransport(loop=loop) + + self.assertEqual(transport.get_write_buffer_limits(), + (16 * 1024, 64 * 1024)) + + transport.set_write_buffer_limits(low=100) + self.assertEqual(transport.get_write_buffer_limits(), (100, 400)) + + transport.set_write_buffer_limits(high=200) + self.assertEqual(transport.get_write_buffer_limits(), (50, 200)) + if __name__ == '__main__': unittest.main()