def test_main(verbose=None): 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(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. import test_support, test.test_descrtut test_support.run_doctest(test.test_descrtut, verbose)
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(verbose=None): import doctest, 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): 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(): 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): 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 import test_deque test_support.run_doctest(test_deque, verbose)
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 import test_deque test_support.run_doctest(test_deque, verbose)
C = Cookie.SimpleCookie() ; C.load(data) print repr(C) print str(C) items = dict.items() items.sort() for k, v in items: print ' ', k, repr( C[k].value ), repr(v) verify(C[k].value == v) print C[k] C = Cookie.SimpleCookie() C.load('Customer="WILE_E_COYOTE"; Version=1; Path=/acme') verify(C['Customer'].value == 'WILE_E_COYOTE') verify(C['Customer']['version'] == '1') verify(C['Customer']['path'] == '/acme') print C.output(['path']) print C.js_output() print C.js_output(['path']) # Try cookie with quoted meta-data C = Cookie.SimpleCookie() C.load('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"') verify(C['Customer'].value == 'WILE_E_COYOTE') verify(C['Customer']['version'] == '1') verify(C['Customer']['path'] == '/acme') print "If anything blows up after this line, it's from Cookie's doctest." run_doctest(Cookie)
"""A module to test whether doctest recognizes some 2.2 features,
from __future__ import generators
# Simple test suite for Cookie.py from test_support import verify, verbose, run_doctest import Cookie # Currently this only tests SimpleCookie cases = [ ('chips=ahoy; vienna=finger', {'chips':'ahoy', 'vienna':'finger'}), ('keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;";', {'keebler' : 'E=mc2; L="Loves"; fudge=\012;'}), # Check illegal cookies that have an '=' char in an unquoted value ('keebler=E=mc2;', {'keebler' : 'E=mc2'}) ] for data, dict in cases: C = Cookie.SimpleCookie() ; C.load(data) print repr(C) print str(C) items = dict.items() items.sort() for k, v in items: print ' ', k, repr( C[k].value ), repr(v) verify(C[k].value == v) print C[k] C = Cookie.SimpleCookie() C.load('Customer="WILE_E_COYOTE"; Version=1; Path=/acme') verify(C['Customer'].value == 'WILE_E_COYOTE') verify(C['Customer']['version'] == '1') verify(C['Customer']['path'] == '/acme') print C.output(['path']) print C.js_output() print C.js_output(['path']) # Try cookie with quoted meta-data
import difflib, test_support test_support.run_doctest(difflib)
# This contains most of the executable examples from Guido's descr
import doctest, test_support test_support.run_doctest(doctest)
# Simple test suite for Cookie.py from test_support import verify, verbose, run_doctest import Cookie # Currently this only tests SimpleCookie cases = [ ('chips=ahoy; vienna=finger', { 'chips': 'ahoy', 'vienna': 'finger' }), ('keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;";', { 'keebler': 'E=mc2; L="Loves"; fudge=\012;' }), # Check illegal cookies that have an '=' char in an unquoted value ('keebler=E=mc2;', { 'keebler': 'E=mc2' }) ] for data, dict in cases: C = Cookie.SimpleCookie() C.load(data) print repr(C) print str(C) items = dict.items() items.sort() for k, v in items: print ' ', k, repr(C[k].value), repr(v) verify(C[k].value == v) print C[k] C = Cookie.SimpleCookie() C.load('Customer="WILE_E_COYOTE"; Version=1; Path=/acme')