]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-150315: increase test coverage for `asyncio._FlowControlMixin.set_write_buffer_lim...
authorMohammad Reza <34370960+azibom@users.noreply.github.com>
Sun, 24 May 2026 14:20:55 +0000 (17:50 +0330)
committerGitHub <noreply@github.com>
Sun, 24 May 2026 14:20:55 +0000 (19:50 +0530)
Lib/test/test_asyncio/test_transports.py

index dbb572e2e1536b3fdaeb9d9959da885844c0dbfe..1781f1f67753f3afb492d8fff21fd79317c1ace2 100644 (file)
@@ -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()