def test_main(verbose=None):
    from test import test_sets
    test_support.run_unittest(
        TestSetOfSets,
        TestExceptionPropagation,
        TestBasicOpsEmpty,
        TestBasicOpsSingleton,
        TestBasicOpsTuple,
        TestBasicOpsTriple,
        TestBinaryOps,
        TestUpdateOps,
        TestMutate,
        TestSubsetEqualEmpty,
        TestSubsetEqualNonEmpty,
        TestSubsetEmptyNonEmpty,
        TestSubsetPartial,
        TestSubsetNonOverlap,
        TestOnlySetsNumeric,
        TestOnlySetsDict,
        TestOnlySetsOperator,
        TestOnlySetsTuple,
        TestOnlySetsString,
        TestOnlySetsGenerator,
        TestCopyingEmpty,
        TestCopyingSingleton,
        TestCopyingTriple,
        TestCopyingTuple,
        TestCopyingNested,
        TestIdentities,
    )
    test_support.run_doctest(test_sets, verbose)
Beispiel #2
0
def test_main():
    test_support.run_unittest(
        PickleTests,
        PicklerTests,
        PersPicklerTests
    )
    test_support.run_doctest(pickle)
def test_main(verbose=None):
    NamedTupleDocs = doctest.DocTestSuite(module=collections)
    test_classes = [TestNamedTuple, NamedTupleDocs, TestOneTrickPonyABCs,
                    TestCollectionABCs, TestCounter,
                    TestOrderedDict, GeneralMappingTests, SubclassMappingTests]
    test_support.run_unittest(*test_classes)
    test_support.run_doctest(collections, verbose)
Beispiel #4
0
def test_main(verbose=None):
    from test import test_urllib2
    test_support.run_doctest(test_urllib2, verbose)
    test_support.run_doctest(urllib2, verbose)
    tests = (TrivialTests, OpenerDirectorTests, HandlerTests, MiscTests,
             RequestTests)
    test_support.run_unittest(*tests)
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)
Beispiel #6
0
def test_main(verbose=None):
    from test import test_urllib2

    test_support.run_doctest(test_urllib2, verbose)
    test_support.run_doctest(urllib2, verbose)
    tests = (TrivialTests, OpenerDirectorTests, HandlerTests, MiscTests, RequestTests)
    test_support.run_unittest(*tests)
Beispiel #7
0
def test_main(verbose=None):
    NamedTupleDocs = doctest.DocTestSuite(module=collections)
    test_classes = [TestNamedTuple, NamedTupleDocs, TestOneTrickPonyABCs,
                    TestCollectionABCs, TestCounter,
                    TestOrderedDict, GeneralMappingTests, SubclassMappingTests]
    test_support.run_unittest(*test_classes)
    test_support.run_doctest(collections, verbose)
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)
Beispiel #9
0
    def test_libref_examples(self):
        s = """
        Examples from the Library Reference:  Doc/lib/libgetopt.tex

        An example using only Unix style options:


        >>> import getopt
        >>> args = '-a -b -cfoo -d bar a1 a2'.split()
        >>> args
        ['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']
        >>> optlist, args = getopt.getopt(args, 'abc:d:')
        >>> optlist
        [('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]
        >>> args
        ['a1', 'a2']

        Using long option names is equally easy:


        >>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'
        >>> args = s.split()
        >>> args
        ['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', 'a2']
        >>> optlist, args = getopt.getopt(args, 'x', [
        ...     'condition=', 'output-file=', 'testing'])
        >>> optlist
        [('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-x', '')]
        >>> args
        ['a1', 'a2']
        """

        import types
        m = types.ModuleType("libreftest", s)
        run_doctest(m, verbose)
Beispiel #10
0
def test_main():
    test_support.run_unittest(
        PickleTests,
        PicklerTests,
        PersPicklerTests
    )
    test_support.run_doctest(pickle)
def test_main(verbose=None):
    NamedTupleDocs = doctest.DocTestSuite(module=collections)
    test_classes = [
        TestNamedTuple, NamedTupleDocs, TestOneTrickPonyABCs,
        TestCollectionABCs, TestCounter
    ]
    test_support.run_unittest(*test_classes)
    test_support.run_doctest(collections, verbose)
Beispiel #12
0
def test_main():
    test_support.run_unittest(
        ReferencesTestCase,
        MappingTestCase,
        WeakValueDictionaryTestCase,
        WeakKeyDictionaryTestCase,
        )
    test_support.run_doctest(sys.modules[__name__])
Beispiel #13
0
def test_main(verbose=None):
    # Obscure:  import this module as test.test_descrtut instead of as
    # plain test_descrtut because the name of this module works its way
    # into the doctest examples, and unless the full test.test_descrtut
    # business is used the name can change depending on how the test is
    # invoked.
    from test import test_support, test_descrtut
    test_support.run_doctest(test_descrtut, verbose)
def test_main(verbose=None):
    if sys.flags.optimize >= 2:
        print >>sys.stderr, "test_collections -- skipping some tests due to -O flag."
        sys.stderr.flush()
    NamedTupleDocs = doctest.DocTestSuite(module=collections)
    test_classes = [TestNamedTuple, NamedTupleDocs, TestOneTrickPonyABCs, TestCollectionABCs]
    test_support.run_unittest(*test_classes)
    test_support.run_doctest(collections, verbose)
Beispiel #15
0
def test_main():
    test_support.run_unittest(
        ReferencesTestCase,
        MappingTestCase,
        WeakValueDictionaryTestCase,
        WeakKeyDictionaryTestCase,
    )
    test_support.run_doctest(sys.modules[__name__])
Beispiel #16
0
def test_main(verbose=None):
    # Obscure:  import this module as test.test_descrtut instead of as
    # plain test_descrtut because the name of this module works its way
    # into the doctest examples, and unless the full test.test_descrtut
    # business is used the name can change depending on how the test is
    # invoked.
    from test import test_support, test_descrtut
    test_support.run_doctest(test_descrtut, verbose)
def test_main():
    test_support.run_unittest(
        PickleTests,
        PicklerTests,
        PersPicklerTests,
        PicklerUnpicklerObjectTests,
        PickleBigmemPickleTests,
    )
    test_support.run_doctest(pickle)
Beispiel #18
0
def test_main():
    test_support.run_unittest(SyntaxTestCase)

    if test_support.due_to_ironpython_bug("http://ironpython.codeplex.com/workitem/28171"):
        return
    from test import test_syntax

    with test_support.check_py3k_warnings(("backquote not supported", SyntaxWarning)):
        test_support.run_doctest(test_syntax, verbosity=True)
Beispiel #19
0
def test_main():
    test_support.run_unittest(
        PickleTests,
        PicklerTests,
        PersPicklerTests,
        PicklerUnpicklerObjectTests,
        PickleBigmemPickleTests,
    )
    test_support.run_doctest(pickle)
Beispiel #20
0
def test_main(verbose=None):
    import doctest
    from test import test_support, test_generators
    if 0:  # change to 1 to run forever (to check for leaks)
        while 1:
            doctest.master = None
            test_support.run_doctest(test_generators, verbose)
            print ".",
    else:
        test_support.run_doctest(test_generators, verbose)
Beispiel #21
0
def test_main():
    test_support.run_unittest(
        ReferencesTestCase,
        MappingTestCase,
        WeakValueDictionaryTestCase,
        WeakKeyDictionaryTestCase,
        SubclassableWeakrefTestCase,
        )
    if not test_support.due_to_ironpython_bug("http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=21116"):
        test_support.run_doctest(sys.modules[__name__])
Beispiel #22
0
def test_main():
    test_support.run_unittest(
        ReferencesTestCase,
        MappingTestCase,
        WeakValueDictionaryTestCase,
        WeakKeyDictionaryTestCase,
        SubclassableWeakrefTestCase,
        )
    if not test_support.due_to_ironpython_bug("http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=21116"):
        test_support.run_doctest(sys.modules[__name__])
Beispiel #23
0
def test_main():
    test_support.run_unittest(SyntaxTestCase)

    if test_support.due_to_ironpython_bug(
            "http://ironpython.codeplex.com/workitem/28171"):
        return
    from test import test_syntax
    with test_support.check_py3k_warnings(
        ("backquote not supported", SyntaxWarning)):
        test_support.run_doctest(test_syntax, verbosity=True)
def test_main(verbose=None):
    import doctest
    from test import test_support, test_generators
    if 0:   # change to 1 to run forever (to check for leaks)
        while 1:
            doctest.master = None
            test_support.run_doctest(test_generators, verbose)
            print ".",
    else:
        test_support.run_doctest(test_generators, verbose)
def test_main(verbose=None):
    if sys.flags.optimize >= 2:
        print >> sys.stderr, "test_collections -- skipping some tests due to -O flag."
        sys.stderr.flush()
    NamedTupleDocs = doctest.DocTestSuite(module=collections)
    test_classes = [
        TestNamedTuple, NamedTupleDocs, TestOneTrickPonyABCs,
        TestCollectionABCs
    ]
    test_support.run_unittest(*test_classes)
    test_support.run_doctest(collections, verbose)
Beispiel #26
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)
Beispiel #27
0
def test_main(verbose=None):
    import sys
    from test import test_support
    from test import test_genexps
    test_support.run_doctest(test_genexps, verbose)

    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):
        import gc
        counts = [None] * 5
        for i in xrange(len(counts)):
            test_support.run_doctest(test_genexps, verbose)
            gc.collect()
            counts[i] = sys.gettotalrefcount()
        print counts
Beispiel #28
0
def test_main(verbose=None):
    import sys
    from test import test_support
    from test import test_genexps
    test_support.run_doctest(test_genexps, verbose)

    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):
        import gc
        counts = [None] * 5
        for i in xrange(len(counts)):
            test_support.run_doctest(test_genexps, verbose)
            gc.collect()
            counts[i] = sys.gettotalrefcount()
        print counts
Beispiel #29
0
def test_main():
    from test import test_doctest2
    EXPECTED = 19
    f, t = test_support.run_doctest(test_doctest2)
    if t != EXPECTED:
        raise test_support.TestFailed("expected %d tests to run, not %d" %
                                      (EXPECTED, t))
Beispiel #30
0
def test_main():
    from test import test_doctest2
    EXPECTED = 19
    f, t = test_support.run_doctest(test_doctest2)
    if t != EXPECTED:
        raise test_support.TestFailed("expected %d tests to run, not %d" %
                                      (EXPECTED, t))
def test_main(verbose=None):
    test_classes = (TestBasicOps, TestVariousIteratorArgs, TestGC)
    test_support.run_unittest(*test_classes)

    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):
        import gc
        counts = [None] * 5
        for i in xrange(len(counts)):
            test_support.run_unittest(*test_classes)
            gc.collect()
            counts[i] = sys.gettotalrefcount()
        print counts

    # doctest the examples in the library reference
    test_support.run_doctest(sys.modules[__name__], verbose)
Beispiel #32
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'
Beispiel #33
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'
Beispiel #34
0
def test_main(verbose=None):
    test_classes = (TestBasicOps, TestVariousIteratorArgs, TestGC,
                    RegressionTests, LengthTransparency)
    test_support.run_unittest(*test_classes)

    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):
        import gc
        counts = [None] * 5
        for i in xrange(len(counts)):
            test_support.run_unittest(*test_classes)
            gc.collect()
            counts[i] = sys.gettotalrefcount()
        print counts

    # doctest the examples in the library reference
    test_support.run_doctest(sys.modules[__name__], verbose)
Beispiel #35
0
def test_main():
    if test_support.is_jython:
        # Probably CPython GC specific (possibly even Jython bugs)
        del ReferencesTestCase.test_callback_in_cycle_resurrection
        del ReferencesTestCase.test_callbacks_on_callback

        # Jython allows types to be weakref'd that CPython doesn't
        del MappingTestCase.test_weak_keyed_bad_delitem

        # CPython GC specific
        del MappingTestCase.test_weak_keyed_cascading_deletes
    test_support.run_unittest(
        ReferencesTestCase,
        MappingTestCase,
        WeakValueDictionaryTestCase,
        WeakKeyDictionaryTestCase,
        )
    test_support.run_doctest(sys.modules[__name__])
Beispiel #36
0
def test_main():
    if test_support.is_jython:
        # Probably CPython GC specific (possibly even Jython bugs)
        del ReferencesTestCase.test_callback_in_cycle_resurrection
        del ReferencesTestCase.test_callbacks_on_callback

        # Jython allows types to be weakref'd that CPython doesn't
        del MappingTestCase.test_weak_keyed_bad_delitem

        # CPython GC specific
        del MappingTestCase.test_weak_keyed_cascading_deletes
    test_support.run_unittest(
        ReferencesTestCase,
        MappingTestCase,
        WeakValueDictionaryTestCase,
        WeakKeyDictionaryTestCase,
    )
    test_support.run_doctest(sys.modules[__name__])
Beispiel #37
0
def test_main():
    from test import test_xml_etree, test_xml_etree_c

    # Run the tests specific to the C implementation
    test_support.run_doctest(test_xml_etree_c, verbosity=True)

    # Assign the C implementation before running the doctests
    # Patch the __name__, to prevent confusion with the pure Python test
    pyET = test_xml_etree.ET
    py__name__ = test_xml_etree.__name__
    test_xml_etree.ET = cET
    if __name__ != '__main__':
        test_xml_etree.__name__ = __name__
    try:
        # Run the same test suite as xml.etree.ElementTree
        test_xml_etree.test_main(module_name='xml.etree.cElementTree')
    finally:
        test_xml_etree.ET = pyET
        test_xml_etree.__name__ = py__name__
Beispiel #38
0
def test_main():
    from test import test_xml_etree, test_xml_etree_c

    # Run the tests specific to the C implementation
    test_support.run_doctest(test_xml_etree_c, verbosity=True)

    # Assign the C implementation before running the doctests
    # Patch the __name__, to prevent confusion with the pure Python test
    pyET = test_xml_etree.ET
    py__name__ = test_xml_etree.__name__
    test_xml_etree.ET = cET
    if __name__ != '__main__':
        test_xml_etree.__name__ = __name__
    try:
        # Run the same test suite as xml.etree.ElementTree
        test_xml_etree.test_main(module_name='xml.etree.cElementTree')
    finally:
        test_xml_etree.ET = pyET
        test_xml_etree.__name__ = py__name__
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)
Beispiel #40
0
def test_main(verbose=None):
    from test import test_bisect

    test_classes = [TestBisectPython, TestBisectC,
                    TestInsortPython, TestInsortC,
                    TestErrorHandlingPython, TestErrorHandlingC]

    test_support.run_unittest(*test_classes)
    test_support.run_doctest(test_bisect, verbose)

    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):
        import gc
        counts = [None] * 5
        for i in xrange(len(counts)):
            test_support.run_unittest(*test_classes)
            gc.collect()
            counts[i] = sys.gettotalrefcount()
        print counts
Beispiel #41
0
def test_main(verbose=None):
    from test import test_bisect

    test_classes = [TestBisectPython, TestBisectC,
                    TestInsortPython, TestInsortC,
                    TestErrorHandlingPython, TestErrorHandlingC]

    test_support.run_unittest(*test_classes)
    test_support.run_doctest(test_bisect, verbose)

    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):
        import gc
        counts = [None] * 5
        for i in xrange(len(counts)):
            test_support.run_unittest(*test_classes)
            gc.collect()
            counts[i] = sys.gettotalrefcount()
        print counts
Beispiel #42
0
def test_main(verbose=None):
    from test import test_bisect
    from types import BuiltinFunctionType
    import sys

    test_classes = [TestBisect, TestInsort]
    if isinstance(bisect_left, BuiltinFunctionType):
        test_classes.append(TestErrorHandling)

    test_support.run_unittest(*test_classes)
    test_support.run_doctest(test_bisect, verbose)

    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):
        import gc
        counts = [None] * 5
        for i in xrange(len(counts)):
            test_support.run_unittest(*test_classes)
            gc.collect()
            counts[i] = sys.gettotalrefcount()
        print counts
def test_main(verbose=None):
    from test import test_bisect
    from types import BuiltinFunctionType
    import sys

    test_classes = [TestBisect, TestInsort]
    if isinstance(bisect_left, BuiltinFunctionType):
        test_classes.append(TestErrorHandling)

    test_support.run_unittest(*test_classes)
    test_support.run_doctest(test_bisect, verbose)

    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):
        import gc
        counts = [None] * 5
        for i in xrange(len(counts)):
            test_support.run_unittest(*test_classes)
            gc.collect()
            counts[i] = sys.gettotalrefcount()
        print counts
Beispiel #44
0
def test_main(verbose=None):
    import sys

    test_classes = (TestBasic, TestVariousIteratorArgs, TestSubclass, TestSubclassWithKwargs)

    test_support.run_unittest(*test_classes)

    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):
        import gc

        counts = [None] * 5
        for i in xrange(len(counts)):
            test_support.run_unittest(*test_classes)
            gc.collect()
            counts[i] = sys.gettotalrefcount()
        print counts

    # doctests
    from test import test_deque

    test_support.run_doctest(test_deque, verbose)
def test_main():
    from test import test_doctest2
    if sys.flags.optimize >= 2:
        print >> sys.stderr, "test_doctest2 --",
        print >> sys.stderr, "skipping some tests due to -O flag."
        sys.stderr.flush()
        EXPECTED = 3
    else:
        EXPECTED = 19
    f, t = test_support.run_doctest(test_doctest2)
    if t != EXPECTED:
        raise test_support.TestFailed("expected %d tests to run, not %d" %
                                      (EXPECTED, t))
def test_main():
    from test import test_doctest2
    if sys.flags.optimize >= 2:
        print >>sys.stderr, "test_doctest2 --",
        print >>sys.stderr, "skipping some tests due to -O flag."
        sys.stderr.flush()
        EXPECTED = 3
    else:
        EXPECTED = 19
    f, t = test_support.run_doctest(test_doctest2)
    if t != EXPECTED:
        raise test_support.TestFailed("expected %d tests to run, not %d" %
                                      (EXPECTED, t))
Beispiel #47
0
def test_main(verbose=None):
    import sys
    test_classes = (
        TestBasic,
        TestVariousIteratorArgs,
        TestSubclass,
    )

    test_support.run_unittest(*test_classes)

    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):
        import gc
        counts = [None] * 5
        for i in xrange(len(counts)):
            test_support.run_unittest(*test_classes)
            gc.collect()
            counts[i] = sys.gettotalrefcount()
        print counts

    # doctests
    from test import test_deque
    test_support.run_doctest(test_deque, verbose)
Beispiel #48
0
def test_main():
    test_support.run_unittest(SyntaxTestCase)
    from test import test_syntax
    with test_support.check_py3k_warnings(("backquote not supported",
                                             SyntaxWarning)):
        test_support.run_doctest(test_syntax, verbosity=True)
Beispiel #49
0
def test_main(verbose=None):
    from test import test_code
    run_doctest(test_code, verbose)
    run_unittest(CodeTest, CodeWeakRefTest)
Beispiel #50
0
def test_main():
    from test import test_tokenize
    test_support.run_doctest(test_tokenize, True)
Beispiel #51
0
def test_main(verbose=None):
    from test import test_cmd
    test_support.run_doctest(test_cmd, verbose)
Beispiel #52
0
def test_main():
    import test_extcall  # self import
    test_support.run_doctest(test_extcall, True)
Beispiel #53
0
def test_main():
    from test import test_tokenize

    test_support.run_doctest(test_tokenize, True)
Beispiel #54
0
def test_main():
    run_unittest(CookieTests)
    with check_warnings(
        ('.+Cookie class is insecure; do not use it', DeprecationWarning)):
        run_doctest(Cookie)
def test_main(verbose=None):
    NamedTupleDocs = doctest.DocTestSuite(module=collections)
    test_classes = [TestNamedTuple, NamedTupleDocs, TestOneTrickPonyABCs, TestCollectionABCs]
    test_support.run_unittest(*test_classes)
    test_support.run_doctest(collections, verbose)
Beispiel #56
0
def test_main(verbose=None):
    from test import test_support, test_generators
    test_support.run_doctest(test_generators, verbose)
def test_main():
    from test import test_xml_etree_c
    test_support.run_doctest(test_xml_etree_c, verbosity=True)
Beispiel #58
0
def test_main(verbose=None):
    from test import test_support
    from test import test_code
    test_support.run_doctest(test_code, verbose)
    test_support.run_unittest(CodeWeakRefTests)
>>> optlist
[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]
>>> args
['a1', 'a2']

Using long option names is equally easy:


>>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'
>>> args = s.split()
>>> args
['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', 'a2']
>>> optlist, args = getopt.getopt(args, 'x', [
...     'condition=', 'output-file=', 'testing'])
>>> optlist
[('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-x', '')]
>>> args
['a1', 'a2']

"""

__test__ = {'libreftest' : libreftest}

import sys
run_doctest(sys.modules[__name__], verbose)

#------------------------------------------------------------------------------

if verbose:
    print "Module getopt: tests completed successfully."