Example #1
0
def test_main(verbose=False):
    if skip_expected:
        raise test_support.TestSkipped("No SSL support")

    global CERTFILE, TESTPORT, SVN_PYTHON_ORG_ROOT_CERT
    CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir,
                            "keycert.pem")
    SVN_PYTHON_ORG_ROOT_CERT = os.path.join(
        os.path.dirname(__file__) or os.curdir,
        "https_svn_python_org_root.pem")

    if (not os.path.exists(CERTFILE) or
        not os.path.exists(SVN_PYTHON_ORG_ROOT_CERT)):
        raise test_support.TestFailed("Can't read certificate files!")

    TESTPORT = findtestsocket(10025, 12000)
    if not TESTPORT:
        raise test_support.TestFailed("Can't find open port to test servers on!")

    tests = [BasicTests]

    if test_support.is_resource_enabled('network'):
        tests.append(NetworkedTests)

    if _have_threads:
        if CERTFILE and test_support.is_resource_enabled('network'):
            tests.append(ThreadedTests)

    test_support.run_unittest(*tests)
Example #2
0
def test_main(verbose=False):
    if skip_expected:
        raise test_support.TestSkipped("No SSL support")

    global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT
    CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir,
                            "keycert.pem")
    SVN_PYTHON_ORG_ROOT_CERT = os.path.join(
        os.path.dirname(__file__) or os.curdir,
        "https_svn_python_org_root.pem")

    if (not os.path.exists(CERTFILE) or
        not os.path.exists(SVN_PYTHON_ORG_ROOT_CERT)):
        raise test_support.TestFailed("Can't read certificate files!")

    TESTPORT = test_support.find_unused_port()
    if not TESTPORT:
        raise test_support.TestFailed("Can't find open port to test servers on!")

    tests = [BasicTests]

    if test_support.is_resource_enabled('network'):
        tests.append(NetworkedTests)

    if _have_threads:
        thread_info = test_support.threading_setup()
        if thread_info and test_support.is_resource_enabled('network'):
            tests.append(ThreadedTests)

    test_support.run_unittest(*tests)

    if _have_threads:
        test_support.threading_cleanup(*thread_info)
Example #3
0
def test_main(verbose=False):
    if skip_expected:
        raise test_support.TestSkipped("No SSL support")

    global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT
    CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "keycert.pem")
    SVN_PYTHON_ORG_ROOT_CERT = os.path.join(os.path.dirname(__file__) or os.curdir, "https_svn_python_org_root.pem")

    if not os.path.exists(CERTFILE) or not os.path.exists(SVN_PYTHON_ORG_ROOT_CERT):
        raise test_support.TestFailed("Can't read certificate files!")

    TESTPORT = test_support.find_unused_port()
    if not TESTPORT:
        raise test_support.TestFailed("Can't find open port to test servers on!")

    tests = [BasicTests]

    if test_support.is_resource_enabled("network"):
        tests.append(NetworkedTests)

    if _have_threads:
        thread_info = test_support.threading_setup()
        if thread_info and test_support.is_resource_enabled("network"):
            tests.append(ThreadedTests)

    test_support.run_unittest(*tests)

    if _have_threads:
        test_support.threading_cleanup(*thread_info)
Example #4
0
def test_main(verbose=False):
    if skip_expected:
        raise test_support.TestSkipped("No SSL support")

    global CERTFILE, TESTPORT, SVN_PYTHON_ORG_ROOT_CERT
    CERTFILE = os.path.join(
        os.path.dirname(__file__) or os.curdir, "keycert.pem")
    SVN_PYTHON_ORG_ROOT_CERT = os.path.join(
        os.path.dirname(__file__) or os.curdir, "root.crt")

    if (not os.path.exists(CERTFILE)
            or not os.path.exists(SVN_PYTHON_ORG_ROOT_CERT)):
        raise test_support.TestFailed("Can't read certificate files!")

    TESTPORT = findtestsocket(10025, 12000)
    if not TESTPORT:
        raise test_support.TestFailed(
            "Can't find open port to test servers on!")

    tests = [BasicTests]

    if test_support.is_resource_enabled('network'):
        tests.append(NetworkedTests)

    if _have_threads:
        if CERTFILE and test_support.is_resource_enabled('network'):
            tests.append(ThreadedTests)

    test_support.run_unittest(*tests)
Example #5
0
def test_main(arith=False, verbose=None):
    """ Execute the tests.

    Runs all arithmetic tests if arith is True or if the "decimal" resource
    is enabled in regrtest.py
    """

    init()
    global TEST_ALL
    TEST_ALL = arith or is_resource_enabled('decimal')

    test_classes = [
        DecimalExplicitConstructionTest,
        DecimalImplicitConstructionTest,
        DecimalArithmeticOperatorsTest,
        DecimalUseOfContextTest,
        DecimalUsabilityTest,
        DecimalPythonAPItests,
        ContextAPItests,
        DecimalTest,
        WithStatementTest,
    ]

    try:
        run_unittest(*test_classes)
        import decimal as DecimalModule
        run_doctest(DecimalModule, verbose)
    finally:
        setcontext(ORIGINAL_CONTEXT)
Example #6
0
def test_main(arith=False, verbose=None):
    """ Execute the tests.

    Runs all arithmetic tests if arith is True or if the "decimal" resource
    is enabled in regrtest.py
    """

    init()
    global TEST_ALL
    TEST_ALL = arith or is_resource_enabled('decimal')

    test_classes = [
        DecimalExplicitConstructionTest,
        DecimalImplicitConstructionTest,
        DecimalArithmeticOperatorsTest,
        DecimalUseOfContextTest,
        DecimalUsabilityTest,
        DecimalPythonAPItests,
        ContextAPItests,
        DecimalTest,
        WithStatementTest,
    ]

    try:
        run_unittest(*test_classes)
        import decimal as DecimalModule
        run_doctest(DecimalModule, verbose)
    finally:
        setcontext(ORIGINAL_CONTEXT)
Example #7
0
def test_main():
    tests = [
                ChdirTestCase,
                ImportTestCase,
                ImportPackageTestCase,
                ZipimportTestCase,
                PyCompileTestCase,
                ExecfileTestCase,
                ExecfileTracebackTestCase,
                ListdirTestCase,
                DirsTestCase,
                FilesTestCase,
                SymlinkTestCase
            ]
    if WINDOWS:
        tests.append(WindowsChdirTestCase)
        tests.remove(SymlinkTestCase)       #  os.symlink ... Availability: Unix.

    if test_support.is_jython:
        tests.extend((ImportJavaClassTestCase,
                      ImportJarTestCase))
 
    if test_support.is_resource_enabled('subprocess'):
        tests.append(SubprocessTestCase)

    test_support.run_unittest(*tests)
Example #8
0
def test_main(verbose=None):
    tests = (TrivialTests,
             OpenerDirectorTests,
             HandlerTests,
             MiscTests)
    if test_support.is_resource_enabled('network'):
        tests += (NetworkTests,)
    test_support.run_unittest(*tests)
def test_main(verbose=None):
    tests = (TrivialTests,
             OpenerDirectorTests,
             HandlerTests,
             MiscTests)
    if test_support.is_resource_enabled('network'):
        tests += (NetworkTests,)
    test_support.run_unittest(*tests)
Example #10
0
def test_main():
    tests = [TestImaplib]

    if support.is_resource_enabled("network"):
        if ssl:
            global CERTFILE
            CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "keycert.pem")
            if not os.path.exists(CERTFILE):
                raise support.TestFailed("Can't read certificate files!")
        tests.extend([ThreadedNetworkedTests, ThreadedNetworkedTestsSSL, RemoteIMAPTest, RemoteIMAP_SSLTest])

    support.run_unittest(*tests)
Example #11
0
def test_main():
    tests = [
        ChdirTestCase, ImportTestCase, ImportPackageTestCase,
        ZipimportTestCase, PyCompileTestCase, ExecfileTestCase,
        ExecfileTracebackTestCase, ListdirTestCase, DirsTestCase, FilesTestCase
    ]
    if WINDOWS:
        tests.append(WindowsChdirTestCase)
    if test_support.is_jython:
        tests.extend((ImportJavaClassTestCase, ImportJarTestCase))
    if test_support.is_resource_enabled('subprocess'):
        tests.append(SubprocessTestCase)
    test_support.run_unittest(*tests)
Example #12
0
def test_main(arith=False, verbose=None, todo_tests=None, debug=None):
    """ Execute the tests.

    Runs all arithmetic tests if arith is True or if the "decimal" resource
    is enabled in regrtest.py
    """

    init()
    global TEST_ALL, DEBUG
    TEST_ALL = arith or is_resource_enabled("decimal")
    DEBUG = debug

    if todo_tests is None:
        test_classes = [
            DecimalExplicitConstructionTest,
            DecimalImplicitConstructionTest,
            DecimalArithmeticOperatorsTest,
            DecimalFormatTest,
            DecimalUseOfContextTest,
            DecimalUsabilityTest,
            DecimalPythonAPItests,
            ContextAPItests,
            DecimalTest,
            WithStatementTest,
            ContextFlags,
        ]
    else:
        test_classes = [DecimalTest]

    # Dynamically build custom test definition for each file in the test
    # directory and add the definitions to the DecimalTest class.  This
    # procedure insures that new files do not get skipped.
    for filename in os.listdir(directory):
        if ".decTest" not in filename or filename.startswith("."):
            continue
        head, tail = filename.split(".")
        if todo_tests is not None and head not in todo_tests:
            continue
        tester = lambda self, f=filename: self.eval_file(directory + f)
        setattr(DecimalTest, "test_" + head, tester)
        del filename, head, tail, tester

    try:
        run_unittest(*test_classes)
        if todo_tests is None:
            import decimal as DecimalModule

            run_doctest(DecimalModule, verbose)
    finally:
        setcontext(ORIGINAL_CONTEXT)
Example #13
0
def test_main():

    tests = [TestImaplib]

    if support.is_resource_enabled('network'):
        if ssl:
            global CERTFILE
            CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir,
                                    "keycert.pem")
            if not os.path.exists(CERTFILE):
                raise support.TestFailed("Can't read certificate files!")
        tests.extend([ThreadedNetworkedTests, ThreadedNetworkedTestsSSL])

    support.run_unittest(*tests)
Example #14
0
 def test_no_leaking(self):
     # Make sure we leak no resources
     if test_support.is_resource_enabled("subprocess") and not mswindows:
         max_handles = 1026 # too much for most UNIX systems
     else:
         max_handles = 65
     for i in range(max_handles):
         p = subprocess.Popen([sys.executable, "-c",
                 "import sys;sys.stdout.write(sys.stdin.read())"],
                 stdin=subprocess.PIPE,
                 stdout=subprocess.PIPE,
                 stderr=subprocess.PIPE)
         data = p.communicate("lime")[0]
         self.assertEqual(data, "lime")
Example #15
0
 def test_no_leaking(self):
     # Make sure we leak no resources
     if not hasattr(test_support, "is_resource_enabled") \
            or test_support.is_resource_enabled("subprocess") and not mswindows:
         max_handles = 1026 # too much for most UNIX systems
     else:
         max_handles = 65
     for i in range(max_handles):
         p = subprocess.Popen([sys.executable, "-c",
                 "import sys;sys.stdout.write(sys.stdin.read())"],
                 stdin=subprocess.PIPE,
                 stdout=subprocess.PIPE,
                 stderr=subprocess.PIPE)
         data = p.communicate("lime")[0]
         self.assertEqual(data, "lime")
Example #16
0
 def test_large_file_ops(self):
     # On Windows and Mac OSX this test comsumes large resources; It takes
     # a long time to build the >2GB file and takes >2GB of disk space
     # therefore the resource must be enabled to run this test.
     if sys.platform[:3] in ("win", "os2") or sys.platform == "darwin":
         if not test_support.is_resource_enabled("largefile"):
             print("\nTesting large file ops skipped on %s." % sys.platform, file=sys.stderr)
             print("It requires %d bytes and a long time." % self.LARGE, file=sys.stderr)
             print("Use 'regrtest.py -u largefile test_io' to run it.", file=sys.stderr)
             return
     f = io.open(test_support.TESTFN, "w+b", 0)
     self.large_file_ops(f)
     f.close()
     f = io.open(test_support.TESTFN, "w+b")
     self.large_file_ops(f)
     f.close()
Example #17
0
def test_main():
    if not test_support.is_resource_enabled("xpickle"):
        print >> sys.stderr, "test_xpickle -- skipping backwards compat tests."
        print >> sys.stderr, "Use 'regrtest.py -u xpickle' to run them."
        sys.stderr.flush()

    test_support.run_unittest(
        DumpCPickle_LoadPickle,
        DumpPickle_LoadCPickle,
        CPicklePython24Compat,
        CPicklePython25Compat,
        CPicklePython26Compat,
        PicklePython24Compat,
        PicklePython25Compat,
        PicklePython26Compat,
    )
Example #18
0
def test_main():
    if not test_support.is_resource_enabled("xpickle"):
        print >>sys.stderr, "test_xpickle -- skipping backwards compat tests."
        print >>sys.stderr, "Use 'regrtest.py -u xpickle' to run them."
        sys.stderr.flush()

    test_support.run_unittest(
        DumpCPickle_LoadPickle,
        DumpPickle_LoadCPickle,
        CPicklePython24Compat,
        CPicklePython25Compat,
        CPicklePython26Compat,
        PicklePython24Compat,
        PicklePython25Compat,
        PicklePython26Compat,
    )
Example #19
0
def test_main():
    if verbose:
        print 'starting...'

    # This displays the tokenization of tokenize_tests.py to stdout, and
    # regrtest.py checks that this equals the expected output (in the
    # test/output/ directory).
    f = open(findfile('tokenize_tests' + os.extsep + 'txt'))
    tokenize(f.readline)
    f.close()

    # Now run test_roundtrip() over tokenize_test.py too, and over all
    # (if the "compiler" resource is enabled) or a small random sample (if
    # "compiler" is not enabled) of the test*.py files.
    f = findfile('tokenize_tests' + os.extsep + 'txt')
    test_roundtrip(f)

    testdir = os.path.dirname(f) or os.curdir
    testfiles = glob.glob(testdir + os.sep + 'test*.py')
    if not is_resource_enabled('compiler'):
        testfiles = random.sample(testfiles, 10)

    for f in testfiles:
        test_roundtrip(f)

    # Test detecton of IndentationError.
    sampleBadText = """\
def foo():
    bar
  baz
"""

    try:
        for tok in generate_tokens(StringIO(sampleBadText).readline):
            pass
    except IndentationError:
        pass
    else:
        raise TestFailed("Did not detect IndentationError:")

    # Run the doctests in this module.
    from test import test_tokenize  # i.e., this module
    from test.test_support import run_doctest
    run_doctest(test_tokenize)

    if verbose:
        print 'finished'
Example #20
0
def test_main():
    if verbose:
        print 'starting...'

    # This displays the tokenization of tokenize_tests.py to stdout, and
    # regrtest.py checks that this equals the expected output (in the
    # test/output/ directory).
    f = open(findfile('tokenize_tests' + os.extsep + 'txt'))
    tokenize(f.readline)
    f.close()

    # Now run test_roundtrip() over tokenize_test.py too, and over all
    # (if the "compiler" resource is enabled) or a small random sample (if
    # "compiler" is not enabled) of the test*.py files.
    f = findfile('tokenize_tests' + os.extsep + 'txt')
    test_roundtrip(f)

    testdir = os.path.dirname(f) or os.curdir
    testfiles = glob.glob(testdir + os.sep + 'test*.py')
    if not is_resource_enabled('compiler'):
        testfiles = random.sample(testfiles, 10)

    for f in testfiles:
        test_roundtrip(f)

    # Test detecton of IndentationError.
    sampleBadText = """\
def foo():
    bar
  baz
"""

    try:
        for tok in generate_tokens(StringIO(sampleBadText).readline):
            pass
    except IndentationError:
        pass
    else:
        raise TestFailed("Did not detect IndentationError:")

    # Run the doctests in this module.
    from test import test_tokenize  # i.e., this module
    from test.test_support import run_doctest
    run_doctest(test_tokenize)

    if verbose:
        print 'finished'
Example #21
0
    def testSSLconnect(self):
        if not test_support.is_resource_enabled("network"):
            return
        s = ssl.wrap_socket(socket.socket(socket.AF_INET), cert_reqs=ssl.CERT_NONE)
        s.connect(("svn.python.org", 443))
        c = s.getpeercert()
        if c:
            raise test_support.TestFailed("Peer cert %s shouldn't be here!")
        s.close()

        # this should fail because we have no verification certs
        s = ssl.wrap_socket(socket.socket(socket.AF_INET), cert_reqs=ssl.CERT_REQUIRED)
        try:
            s.connect(("svn.python.org", 443))
        except ssl.SSLError:
            pass
        finally:
            s.close()
Example #22
0
def test_main():
    tests = [TestImaplib]

    if support.is_resource_enabled('network'):
        if ssl:
            global CERTFILE
            CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir,
                                    "keycert.pem")
            if not os.path.exists(CERTFILE):
                raise support.TestFailed("Can't read certificate files!")
            tests.append(ThreadedNetworkedTestsSSL)
        tests.append(ThreadedNetworkedTests)

    threadinfo = support.threading_setup()

    support.run_unittest(*tests)

    support.threading_cleanup(*threadinfo)
Example #23
0
 def test_no_leaking(self):
     # Make sure we leak no resources
     if not hasattr(test_support, "is_resource_enabled") \
            or test_support.is_resource_enabled("subprocess") and not mswindows \
            and not jython:
         max_handles = 1026 # too much for most UNIX systems
     else:
         # Settle for 65 on jython: spawning jython processes takes a
         # long time
         max_handles = 65
     for i in range(max_handles):
         p = subprocess.Popen([sys.executable, "-c",
                 "import sys;sys.stdout.write(sys.stdin.read())"],
                 stdin=subprocess.PIPE,
                 stdout=subprocess.PIPE,
                 stderr=subprocess.PIPE)
         data = p.communicate("lime")[0]
         self.assertEqual(data, "lime")
Example #24
0
    def test_random_files(self):
        # Test roundtrip on random python modules.
        # pass the '-ucpu' option to process the full directory.

        import glob, random
        fn = test_support.findfile("tokenize_tests" + os.extsep + "txt")
        tempdir = os.path.dirname(fn) or os.curdir
        testfiles = glob.glob(os.path.join(tempdir, "test*.py"))

        if not test_support.is_resource_enabled("cpu"):
            testfiles = random.sample(testfiles, 10)

        for testfile in testfiles:
            try:
                with open(testfile, 'rb') as f:
                    self.check_roundtrip(f)
            except:
                print "Roundtrip failed for file %s" % testfile
                raise
Example #25
0
def test_main():
    tests = [ChdirTestCase,
             ImportTestCase,
             ImportPackageTestCase,
             ZipimportTestCase,
             PyCompileTestCase,
             ExecfileTestCase,
             ExecfileTracebackTestCase,
             ListdirTestCase,
             DirsTestCase,
             FilesTestCase]
    if sys.platform.startswith('java'):
        tests.extend((ImportJavaClassTestCase,
                      ImportJarTestCase))
    if test_support.is_resource_enabled('subprocess'):
        tests.append(SubprocessTestCase)
    if WINDOWS:
        tests.append(WindowsChdirTestCase)
    test_support.run_unittest(*tests)
def test_main(arith=False, verbose=None, todo_tests=None, debug=None):
    """ Execute the tests.

    Runs all arithmetic tests if arith is True or if the "decimal" resource
    is enabled in regrtest.py
    """

    init()
    global TEST_ALL, DEBUG
    TEST_ALL = arith or is_resource_enabled('decimal')
    DEBUG = debug

    if todo_tests is None:
        test_classes = [
            DecimalExplicitConstructionTest, DecimalImplicitConstructionTest,
            DecimalArithmeticOperatorsTest, DecimalFormatTest,
            DecimalUseOfContextTest, DecimalUsabilityTest,
            DecimalPythonAPItests, ContextAPItests, DecimalTest,
            WithStatementTest, ContextFlags
        ]
    else:
        test_classes = [DecimalTest]

    # Dynamically build custom test definition for each file in the test
    # directory and add the definitions to the DecimalTest class.  This
    # procedure insures that new files do not get skipped.
    for filename in os.listdir(directory):
        if '.decTest' not in filename or filename.startswith("."):
            continue
        head, tail = filename.split('.')
        if todo_tests is not None and head not in todo_tests:
            continue
        tester = lambda self, f=filename: self.eval_file(directory + f)
        setattr(DecimalTest, 'test_' + head, tester)
        del filename, head, tail, tester

    try:
        run_unittest(*test_classes)
        if todo_tests is None:
            import decimal as DecimalModule
            run_doctest(DecimalModule, verbose)
    finally:
        setcontext(ORIGINAL_CONTEXT)
Example #27
0
 def test_large_file_ops(self):
     # On Windows and Mac OSX this test comsumes large resources; It takes
     # a long time to build the >2GB file and takes >2GB of disk space
     # therefore the resource must be enabled to run this test.
     if sys.platform[:3] in ('win', 'os2') or sys.platform == 'darwin':
         if not test_support.is_resource_enabled("largefile"):
             print("\nTesting large file ops skipped on %s." % sys.platform,
                   file=sys.stderr)
             print("It requires %d bytes and a long time." % self.LARGE,
                   file=sys.stderr)
             print("Use 'regrtest.py -u largefile test_io' to run it.",
                   file=sys.stderr)
             return
     f = io.open(test_support.TESTFN, "w+b", 0)
     self.large_file_ops(f)
     f.close()
     f = io.open(test_support.TESTFN, "w+b")
     self.large_file_ops(f)
     f.close()
Example #28
0
    def test_random_files(self):
        # Test roundtrip on random python modules.
        # pass the '-ucpu' option to process the full directory.

        import glob, random
        fn = test_support.findfile("tokenize_tests" + os.extsep + "txt")
        tempdir = os.path.dirname(fn) or os.curdir
        testfiles = glob.glob(os.path.join(tempdir, "test*.py"))

        if not test_support.is_resource_enabled("cpu"):
            testfiles = random.sample(testfiles, 10)

        for testfile in testfiles:
            try:
                with open(testfile, 'rb') as f:
                    self.check_roundtrip(f)
            except:
                print "Roundtrip failed for file %s" % testfile
                raise
Example #29
0
    def testSSLconnect(self):
        if not test_support.is_resource_enabled('network'):
            return
        s = ssl.wrap_socket(socket.socket(socket.AF_INET),
                            cert_reqs=ssl.CERT_NONE)
        s.connect(("svn.python.org", 443))
        c = s.getpeercert()
        if c:
            raise test_support.TestFailed("Peer cert %s shouldn't be here!")
        s.close()

        # this should fail because we have no verification certs
        s = ssl.wrap_socket(socket.socket(socket.AF_INET),
                            cert_reqs=ssl.CERT_REQUIRED)
        try:
            s.connect(("svn.python.org", 443))
        except ssl.SSLError:
            pass
        finally:
            s.close()
"""Unit tests for socket timeout feature."""

import unittest
from test import test_support

# This requires the 'network' resource as given on the regrtest command line.
skip_expected = not test_support.is_resource_enabled('network')

import time
import socket


class CreationTestCase(unittest.TestCase):
    """Test case for socket.gettimeout() and socket.settimeout()"""

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

    def tearDown(self):
        self.sock.close()

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

    def testFloatReturnValue(self):
        # Test return value of gettimeout()
        self.sock.settimeout(7.345)
        self.assertEqual(self.sock.gettimeout(), 7.345)
Example #31
0
def run_compat_test(python_name):
    return (test_support.is_resource_enabled("xpickle")
            and have_python_version(python_name))
Example #32
0
def run_compat_test(python_name):
    return test_support.is_resource_enabled("xpickle") and have_python_version(python_name)
Example #33
0
"""Unit tests for socket timeout feature."""

import unittest
from test import test_support

# This requires the 'network' resource as given on the regrtest command line.
skip_expected = not test_support.is_resource_enabled('network')

import time
import socket


class CreationTestCase(unittest.TestCase):
    """Test case for socket.gettimeout() and socket.settimeout()"""

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

    def tearDown(self):
        self.sock.close()

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

    def testFloatReturnValue(self):
        # Test return value of gettimeout()
        self.sock.settimeout(7.345)
        self.assertEqual(self.sock.gettimeout(), 7.345)