Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_timeout.CreationTestCase Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def testObjectCreation
def testFloatReturnValue
def testReturnType
def testTypeCheck
def testRangeCheck
def testTimeoutThenBlocking
def testBlockingThenTimeout

Public Attributes

 sock

Detailed Description

Test case for socket.gettimeout() and socket.settimeout()

Definition at line 14 of file test_timeout.py.


Member Function Documentation

Definition at line 17 of file test_timeout.py.

00017 
00018     def setUp(self):
00019         self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

Here is the caller graph for this function:

Definition at line 20 of file test_timeout.py.

00020 
00021     def tearDown(self):
00022         self.sock.close()

Here is the caller graph for this function:

Definition at line 80 of file test_timeout.py.

00080 
00081     def testBlockingThenTimeout(self):
00082         # Test setblocking() followed by settimeout()
00083         self.sock.setblocking(0)
00084         self.sock.settimeout(1)
00085         self.assertEqual(self.sock.gettimeout(), 1)
00086 
00087         self.sock.setblocking(1)
00088         self.sock.settimeout(1)
00089         self.assertEqual(self.sock.gettimeout(), 1)
00090 

Here is the call graph for this function:

Definition at line 28 of file test_timeout.py.

00028 
00029     def testFloatReturnValue(self):
00030         # Test return value of gettimeout()
00031         self.sock.settimeout(7.345)
00032         self.assertEqual(self.sock.gettimeout(), 7.345)
00033 
00034         self.sock.settimeout(3)
00035         self.assertEqual(self.sock.gettimeout(), 3)
00036 
00037         self.sock.settimeout(None)
00038         self.assertEqual(self.sock.gettimeout(), None)

Here is the call graph for this function:

Definition at line 23 of file test_timeout.py.

00023 
00024     def testObjectCreation(self):
00025         # Test Socket creation
00026         self.assertEqual(self.sock.gettimeout(), None,
00027                          "timeout not disabled by default")

Here is the call graph for this function:

Definition at line 60 of file test_timeout.py.

00060 
00061     def testRangeCheck(self):
00062         # Test range checking by settimeout()
00063         self.assertRaises(ValueError, self.sock.settimeout, -1)
00064         self.assertRaises(ValueError, self.sock.settimeout, -1)
00065         self.assertRaises(ValueError, self.sock.settimeout, -1.0)

Here is the call graph for this function:

Definition at line 39 of file test_timeout.py.

00039 
00040     def testReturnType(self):
00041         # Test return type of gettimeout()
00042         self.sock.settimeout(1)
00043         self.assertEqual(type(self.sock.gettimeout()), type(1.0))
00044 
00045         self.sock.settimeout(3.9)
00046         self.assertEqual(type(self.sock.gettimeout()), type(1.0))

Here is the call graph for this function:

Definition at line 66 of file test_timeout.py.

00066 
00067     def testTimeoutThenBlocking(self):
00068         # Test settimeout() followed by setblocking()
00069         self.sock.settimeout(10)
00070         self.sock.setblocking(1)
00071         self.assertEqual(self.sock.gettimeout(), None)
00072         self.sock.setblocking(0)
00073         self.assertEqual(self.sock.gettimeout(), 0.0)
00074 
00075         self.sock.settimeout(10)
00076         self.sock.setblocking(0)
00077         self.assertEqual(self.sock.gettimeout(), 0.0)
00078         self.sock.setblocking(1)
00079         self.assertEqual(self.sock.gettimeout(), None)

Here is the call graph for this function:

Definition at line 47 of file test_timeout.py.

00047 
00048     def testTypeCheck(self):
00049         # Test type checking by settimeout()
00050         self.sock.settimeout(0)
00051         self.sock.settimeout(0)
00052         self.sock.settimeout(0.0)
00053         self.sock.settimeout(None)
00054         self.assertRaises(TypeError, self.sock.settimeout, "")
00055         self.assertRaises(TypeError, self.sock.settimeout, "")
00056         self.assertRaises(TypeError, self.sock.settimeout, ())
00057         self.assertRaises(TypeError, self.sock.settimeout, [])
00058         self.assertRaises(TypeError, self.sock.settimeout, {})
00059         self.assertRaises(TypeError, self.sock.settimeout, 0j)

Here is the call graph for this function:


Member Data Documentation

Definition at line 18 of file test_timeout.py.


The documentation for this class was generated from the following file: