path stringlengths 14 112 | content stringlengths 0 6.32M | size int64 0 6.32M | max_lines int64 1 100k | repo_name stringclasses 2
values | autogenerated bool 1
class |
|---|---|---|---|---|---|
cosmopolitan/third_party/python/Lib/test/test_epoll.py | # Copyright (c) 2001-2006 Twisted Matrix Laboratories.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, m... | 9,209 | 265 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_sort.py | from test import support
import random
import unittest
from functools import cmp_to_key
verbose = support.verbose
nerrors = 0
def check(tag, expected, raw, compare=None):
global nerrors
if verbose:
print(" checking", tag)
orig = raw[:] # save input in case of error
if compare:
... | 8,664 | 266 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/cfgparser.2 | # This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options (perhaps too
# many!) most of which are not shown in this example
#
# Any line which starts with a ; (semi-colon) or a # (hash)
# ... | 19,472 | 538 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_uuid.py | import unittest.mock
from test import support
import builtins
import io
import os
import shutil
import subprocess
import uuid
def importable(name):
try:
__import__(name)
return True
except:
return False
class TestUUID(unittest.TestCase):
def test_UUID(self):
equal = self.as... | 23,725 | 539 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_codecencodings_jp.py | #
# test_codecencodings_jp.py
# Codec encoding tests for Japanese encodings.
#
from test import multibytecodec_support
import unittest
class Test_CP932(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'cp932'
tstring = multibytecodec_support.load_teststring('shift_jis')
codectests = (
... | 4,907 | 127 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_zipimport_support.py | # This test module covers support in various parts of the standard library
# for working with modules located inside zipfiles
# The tests are centralised in this fashion to make it easy to drop them
# if a platform doesn't support zipimport
import test.support
import os
import os.path
import sys
import textwrap
import ... | 10,714 | 245 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/bad_coding2.py | #coding: utf8
print('æ')
| 30 | 3 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_cgitb.py | from test.support import temp_dir
from test.support.script_helper import assert_python_failure
import unittest
import sys
import cgitb
class TestCgitb(unittest.TestCase):
def test_fonts(self):
text = "Hello Robbie!"
self.assertEqual(cgitb.small(text), "<small>{}</small>".format(text))
self... | 2,565 | 69 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/double_const.py | from test.support import TestFailed
# A test for SF bug 422177: manifest float constants varied way too much in
# precision depending on whether Python was loading a module for the first
# time, or reloading it from a precompiled .pyc. The "expected" failure
# mode is that when test_import imports this after all .py... | 1,212 | 31 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_stringprep.py | # To fully test this module, we would need a copy of the stringprep tables.
# Since we don't have them, this test checks only a few code points.
import unittest
from stringprep import *
class StringprepTests(unittest.TestCase):
def test(self):
self.assertTrue(in_table_a1("\u0221"))
self.assertFal... | 3,113 | 93 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_isinstance.py | # Tests some corner cases with isinstance() and issubclass(). While these
# tests use new style classes and properties, they actually do whitebox
# testing of error conditions uncovered when using extension types.
import unittest
import sys
import cosmo
class TestIsInstanceExceptions(unittest.TestCase):
# Tes... | 10,175 | 284 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_eof.py | """test script for a few new invalid token catches"""
import unittest
from test import support
class EOFTestCase(unittest.TestCase):
def test_EOFC(self):
expect = "EOL while scanning string literal (<string>, line 1)"
try:
eval("""'this is a test\
""")
except Syntax... | 803 | 29 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/inspect_fodder.py | # line 1
'A module docstring.'
import sys, inspect
# line 5
# line 7
def spam(a, b, c, d=3, e=4, f=5, *g, **h):
eggs(b + d, c + f)
# line 11
def eggs(x, y):
"A docstring."
global fr, st
fr = inspect.currentframe()
st = inspect.stack()
p = x
q = y / 0
# line 20
class StupidGit:
"""A l... | 1,268 | 83 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_pty.py | from test.support import verbose, import_module, reap_children
# Skip these tests if termios is not available
import_module('termios')
import errno
import pty
import os
import sys
import select
import signal
import socket
import io # readline
import unittest
TEST_STRING_1 = b"I wish to buy a fish license.\n"
TEST_ST... | 11,761 | 314 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/mapping_tests.py | # tests common to dict and UserDict
import unittest
import collections
import sys
import cosmo
class BasicTestMappingProtocol(unittest.TestCase):
# This base class can be used to check that an object conforms to the
# mapping protocol
# Functions that can be useful to override to adapt to dictionary
... | 22,358 | 669 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_wait3.py | """This test checks for correct wait3() behavior.
"""
import os
import time
import unittest
from test.fork_wait import ForkWait
from test.support import reap_children
if not hasattr(os, 'fork'):
raise unittest.SkipTest("os.fork not defined")
if not hasattr(os, 'wait3'):
raise unittest.SkipTest("os.wait3 not ... | 1,183 | 39 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_codecencodings_cn.py | #
# test_codecencodings_cn.py
# Codec encoding tests for PRC encodings.
#
from test import multibytecodec_support
import unittest
class Test_GB2312(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'gb2312'
tstring = multibytecodec_support.load_teststring('gb2312')
codectests = (
#... | 3,944 | 97 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_asynchat.py | # test asynchat
from test import support
# If this fails, the test will be skipped.
thread = support.import_module('_thread')
import asynchat
import asyncore
import errno
import socket
import sys
import time
import unittest
import unittest.mock
try:
import _thread
import threading
except ImportError:
thr... | 10,353 | 310 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_urlparse.py | import sys
import unicodedata
import unittest
import urllib.parse
RFC1808_BASE = "http://a/b/c/d;p?q#f"
RFC2396_BASE = "http://a/b/c/d;p?q"
RFC3986_BASE = 'http://a/b/c/d;p?q'
SIMPLE_BASE = 'http://a/b/c/d'
# Each parse_qsl testcase is a two-tuple that contains
# a string with the query and a list with the expected ... | 61,969 | 1,241 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_unittest.py | import unittest.test
from test import support
def test_main():
# used by regrtest
support.run_unittest(unittest.test.suite())
support.reap_children()
def load_tests(*_):
# used by unittest
return unittest.test.suite()
if __name__ == "__main__":
test_main()
| 286 | 17 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_unicode.py | """ Test script for the Unicode implementation.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
import _string
import codecs
import itertools
import operator
import struct
import string
import sys
import unittest
import warnings
from test import support, str... | 133,215 | 3,018 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_xml_dom_minicompat.py | # Tests for xml.dom.minicompat
import copy
import pickle
import unittest
import xml.dom
from xml.dom.minicompat import *
class EmptyNodeListTestCase(unittest.TestCase):
"""Tests for the EmptyNodeList class."""
def test_emptynodelist_item(self):
# Test item access on an EmptyNodeList.
node_l... | 4,282 | 139 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/ssltests.py | # Convenience test module to run all of the OpenSSL-related tests in the
# standard library.
import ssl
import sys
import subprocess
TESTS = [
'test_asyncio', 'test_ensurepip.py', 'test_ftplib', 'test_hashlib',
'test_hmac', 'test_httplib', 'test_imaplib', 'test_nntplib',
'test_poplib', 'test_ssl', 'test_s... | 1,051 | 38 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/audiotests.py | from test.support import findfile, TESTFN, unlink
import array
import io
import pickle
class UnseekableIO(io.FileIO):
def tell(self):
raise io.UnsupportedOperation
def seek(self, *args, **kwargs):
raise io.UnsupportedOperation
class AudioTests:
close_fd = False
def setUp(self):
... | 12,409 | 330 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_iter.py | # Test iterators.
import sys
import unittest
from test.support import run_unittest, TESTFN, unlink, cpython_only
from test.support import check_free_after_iterating
import pickle
import collections.abc
# Test result of triple loop (too big to inline)
TRIPLETS = [(0, 0, 0), (0, 0, 1), (0, 0, 2),
(0, 1, 0),... | 32,264 | 1,017 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_zipfile64.py | # Tests of the full ZIP64 functionality of zipfile
# The support.requires call is the only reason for keeping this separate
# from test_zipfile
from test import support
# XXX(nnorwitz): disable this test by looking for extralargefile resource,
# which doesn't exist. This test takes over 30 minutes to run in general
#... | 5,861 | 156 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_pprint.py | # -*- coding: utf-8 -*-
import collections
import io
import itertools
import pprint
import random
import test.support
import test.test_set
import types
import unittest
# list, tuple and dict subclasses that do or don't overwrite __repr__
class list2(list):
pass
class list3(list):
def __repr__(self):
... | 44,533 | 1,013 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/bad_coding.py | # -*- coding: uft-8 -*-
| 24 | 2 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_peepholer.py | import dis
import re
import sys
import textwrap
import unittest
from test.bytecode_helper import BytecodeTestCase
class TestTranforms(BytecodeTestCase):
def test_unot(self):
# UNARY_NOT POP_JUMP_IF_FALSE --> POP_JUMP_IF_TRUE'
def unot(x):
if not x == 2:
del x
... | 12,974 | 333 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_cprofile.py | """Test suite for the cProfile module."""
import sys
import unittest
from test.support import run_unittest, TESTFN, unlink
from test.support.script_helper import assert_python_failure
# rip off all interesting stuff from test_profile
import cProfile
from test.test_profile import ProfileTest, regenerate_expected_outpu... | 5,862 | 108 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_mimetypes.py | import io
import locale
import mimetypes
import sys
import unittest
from test import support
# Tell it we don't know about external files:
mimetypes.knownfiles = []
mimetypes.inited = False
mimetypes._default_mime_types()
class MimeTypesTestCase(unittest.TestCase):
def setUp(self):
self.db = mimetypes.M... | 4,294 | 112 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_locale.py | from test.support import verbose, is_android
import unittest
import locale
import sys
import codecs
class BaseLocalizedTest(unittest.TestCase):
#
# Base class for tests using a real locale
#
@classmethod
def setUpClass(cls):
if sys.platform in ('darwin', 'cosmo'):
import os
... | 22,410 | 588 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_binop.py | """Tests for binary operators on subtypes of built-in types."""
import unittest
from test import support
from operator import eq, le, ne
from abc import ABCMeta
def gcd(a, b):
"""Greatest common divisor using Euclid's algorithm."""
while a:
a, b = b%a, a
return b
def isint(x):
"""Test whether... | 14,503 | 442 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_future5.py | # Check that multiple features can be enabled.
from __future__ import unicode_literals, print_function
import sys
import unittest
from test import support
class TestMultipleFeatures(unittest.TestCase):
def test_unicode_literals(self):
self.assertIsInstance("", str)
def test_print_function(self):
... | 510 | 22 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/future_test1.py | """This is a test"""
# Import the name nested_scopes twice to trigger SF bug #407394 (regression).
from __future__ import nested_scopes, nested_scopes
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
| 229 | 12 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_linecache.py | """ Tests for the linecache module """
import linecache
import unittest
import os.path
import tempfile
import tokenize
from test import support
FILENAME = linecache.__file__
NONEXISTENT_FILENAME = FILENAME + '.missing'
INVALID_NAME = '!@$)(!@#_1'
EMPTY = ''
TEST_PATH = os.path.dirname(__file__)
MODULES = "linecache ... | 7,980 | 243 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_netrc.py | import netrc, os, unittest, sys, tempfile, textwrap
from test import support
class NetrcTestCase(unittest.TestCase):
def make_nrc(self, test_data):
test_data = textwrap.dedent(test_data)
mode = 'w'
if sys.platform != 'cygwin':
mode += 't'
temp_fd, temp_filename = tempf... | 4,736 | 134 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/talos-2019-0758.pem | -----BEGIN CERTIFICATE-----
MIIDqDCCApKgAwIBAgIBAjALBgkqhkiG9w0BAQswHzELMAkGA1UEBhMCVUsxEDAO
BgNVBAMTB2NvZHktY2EwHhcNMTgwNjE4MTgwMDU4WhcNMjgwNjE0MTgwMDU4WjA7
MQswCQYDVQQGEwJVSzEsMCoGA1UEAxMjY29kZW5vbWljb24tdm0tMi50ZXN0Lmxh
bC5jaXNjby5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC63fGB
J80A9Av1GB0bptslKRIUtJm8EeEu34Hk... | 1,330 | 23 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_robotparser.py | import io
import os
import unittest
import urllib.robotparser
from test import support
from http.server import BaseHTTPRequestHandler, HTTPServer
try:
import _thread
import threading
except ImportError:
threading = None
class BaseRobotTest:
robots_txt = ''
agent = 'test_robotparser'
good = []
... | 7,561 | 290 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_property.py | # Test case for property
# more tests are in test_descr
import sys
import cosmo
import unittest
from test import support
class PropertyBase(Exception):
pass
class PropertyGet(PropertyBase):
pass
class PropertySet(PropertyBase):
pass
class PropertyDel(PropertyBase):
pass
class BaseClass(object):
... | 9,185 | 285 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_urllib2net.py | import unittest
from test import support
from test.test_urllib2 import sanepathname2url
import os
import socket
import urllib.error
import urllib.request
import sys
support.requires("network")
TIMEOUT = 60 # seconds
def _retry_thrice(func, exc, *args, **kwargs):
for i in range(3):
try:
ret... | 12,710 | 343 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_pyclbr.py | '''
Test cases for pyclbr.py
Nick Mathewson
'''
import sys
from types import FunctionType, MethodType, BuiltinFunctionType
import pyclbr
from unittest import TestCase, main as unittest_main
StaticMethodType = type(staticmethod(lambda: None))
ClassMethodType = type(classmethod(lambda c: None))
# Here we test the... | 6,980 | 177 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/fork_wait.py | """This test case provides support for checking forking and wait behavior.
To test different wait behavior, override the wait_impl method.
We want fork1() semantics -- only the forking thread survives in the
child after a fork().
On some systems (e.g. Solaris without posix threads) we find that all
active threads su... | 2,621 | 92 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/badsyntax_pep3120.py | print("böse")
| 14 | 2 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_html.py | """
Tests for the html module functions.
"""
import html
import unittest
class HtmlTests(unittest.TestCase):
def test_escape(self):
self.assertEqual(
html.escape('\'<script>"&foo;"</script>\''),
''<script>"&foo;"</script>'')
self.assertE... | 4,336 | 104 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_bool.py | # Test properties of bool promised by PEP 285
import unittest
from test import support
import os
class BoolTest(unittest.TestCase):
def test_subclass(self):
try:
class C(bool):
pass
except TypeError:
pass
else:
self.fail("bool should no... | 12,694 | 369 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_funcattrs.py | import types
import unittest
def global_function():
def inner_function():
class LocalClass:
pass
global inner_global_function
def inner_global_function():
def inner_function2():
pass
return inner_function2
return LocalClass
re... | 13,001 | 378 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_cgi.py | from test.support import check_warnings
import cgi
import os
import sys
import tempfile
import unittest
import warnings
from collections import namedtuple
from io import StringIO, BytesIO
from test import support
class HackedSysModule:
# The regression test will have real values in sys.argv, which
# will compl... | 22,374 | 613 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_tracemalloc.py | import contextlib
import os
import sys
import cosmo
if cosmo.MODE == "dbg":
import tracemalloc
import unittest
from unittest.mock import patch
from test.support.script_helper import (assert_python_ok, assert_python_failure,
interpreter_requires_environment)
from test import s... | 36,658 | 1,003 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_syslog.py |
from test import support
syslog = support.import_module("syslog") #skip if not supported
import unittest
# XXX(nnorwitz): This test sucks. I don't know of a platform independent way
# to verify that the messages were really logged.
# The only purpose of this test is to verify the code doesn't crash or leak.
class T... | 1,225 | 44 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/_test_multiprocessing.py | #
# Unit tests for the multiprocessing package
#
import unittest
import queue as pyqueue
import contextlib
import time
import io
import itertools
import sys
import os
import gc
import errno
import signal
import array
import socket
import random
import logging
import struct
import operator
import weakref
from test impo... | 143,810 | 4,523 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_quopri.py | import unittest
import sys, io, subprocess
import quopri
ENCSAMPLE = b"""\
Here's a bunch of special=20
=A1=A2=A3=A4=A5=A6=A7=A8=A9
=AA=AB=AC=AD=AE=AF=B0=B1=B2=B3
=B4=B5=B6=B7=B8=B9=BA=BB=BC=BD=BE
=BF=C0=C1=C2=C3=C4=C5=C6
=C7=C8=C9=CA=CB=CC=CD=CE=CF
=D0=D1=D2=D3=D4=D5=D6=D7
=D8=D9=DA=DB=DC=DD=DE=DF
=E0=E1=E2=E3=E4... | 7,962 | 211 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/list_tests.py | """
Tests common to list and UserList.UserList
"""
import sys
import os
import unittest
import cosmo
from functools import cmp_to_key
from test import support, seq_tests
class CommonTest(seq_tests.CommonTest):
def test_init(self):
# Iterable arg is optional
self.assertEqual(self.type2test([]), ... | 18,925 | 623 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_file_eintr.py | # Written to test interrupted system calls interfering with our many buffered
# IO implementations. http://bugs.python.org/issue12268
#
# It was suggested that this code could be merged into test_io and the tests
# made to work using the same method as the existing signal tests in test_io.
# I was unable to get single... | 10,854 | 253 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_readline.py | """
Very minimal unittests for parts of the readline module.
"""
from contextlib import ExitStack
from errno import EIO
import locale
import os
import selectors
import subprocess
import sys
import tempfile
import unittest
from test.support import import_module, unlink, temp_dir, TESTFN
from test.support.script_helper i... | 12,558 | 318 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_deque.py | from collections import deque
import unittest
from test import support, seq_tests
import gc
import weakref
import copy
import pickle
from io import StringIO
import random
import struct
BIG = 100000
def fail():
raise SyntaxError
yield 1
class BadCmp:
def __eq__(self, other):
raise RuntimeError
cl... | 34,800 | 1,078 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_sched.py | import queue
import sched
import time
import unittest
try:
import _thread
import threading
except ImportError:
threading = None
TIMEOUT = 10
class Timer:
def __init__(self):
self._cond = threading.Condition()
self._time = 0
self._stop = 0
def time(self):
with self... | 6,796 | 206 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_re.py | from test.support import verbose, run_unittest, gc_collect, bigmemtest, _2G, \
cpython_only, captured_stdout
import io
import locale
import re
import sre_compile
import string
import sys
import traceback
import unittest
import warnings
from re import Scanner
from weakref import proxy
# Misc tests from Tim Pete... | 99,028 | 2,089 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_csv.py | # Copyright (C) 2001,2002 Python Software Foundation
# csv package unit tests
import copy
import sys
import unittest
from io import StringIO
from tempfile import TemporaryFile
import csv
import gc
import pickle
from test import support
from itertools import permutations
from textwrap import dedent
from collections imp... | 48,189 | 1,205 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/pythoninfo.py | """
Collect various information about Python to help debugging test failures.
"""
from __future__ import print_function
import errno
import re
import sys
import traceback
if __name__ == 'PYOBJ.COM':
import resource
def normalize_text(text):
if text is None:
return None
text = str(text)
text =... | 16,532 | 646 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_fractions.py | """Tests for Lib/fractions.py."""
from decimal import Decimal
from test.support import requires_IEEE_754
import math
import numbers
import operator
import fractions
import sys
import unittest
import warnings
from copy import copy, deepcopy
from pickle import dumps, loads
F = fractions.Fraction
gcd = fractions.gcd
cla... | 26,545 | 636 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/CP932.TXT | #
# Name: cp932 to Unicode table
# Unicode version: 2.0
# Table version: 2.01
# Table format: Format A
# Date: 04/15/98
#
# Contact: Shawn.Steele@microsoft.com
#
# General notes: none
#
# Format: Three tab-separated columns
# Column #1 is the cp932 code (in hex)
# ... | 79,439 | 7,999 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_smtplib.py | import asyncore
import base64
import email.mime.text
from email.message import EmailMessage
from email.base64mime import body_encode as encode_base64
import email.utils
import hmac
import socket
import smtpd
import smtplib
import io
import re
import sys
import time
import select
import errno
import textwrap
import uni... | 51,778 | 1,332 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_smtpnet.py | import unittest
from test import support
import smtplib
import socket
ssl = support.import_module("ssl")
support.requires("network")
def check_ssl_verifiy(host, port):
context = ssl.create_default_context()
with socket.create_connection((host, port)) as sock:
try:
sock = context.wrap_sock... | 2,763 | 84 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_doctest2.py | """A module to test whether doctest recognizes some 2.2 features,
like static and class methods.
>>> print('yup') # 1
yup
We include some (random) encoded (utf-8) text in the text surrounding
the example. It should be ignored:
ÐÐÐÐÐ
"""
import sys
import cosmo
import unittest
from test import support
if sys... | 2,416 | 127 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_utf8source.py | # This file is marked as binary in the CVS, to prevent MacCVS from recoding it.
import unittest
class PEP3120Test(unittest.TestCase):
def test_pep3120(self):
self.assertEqual(
"ÐиÑон".encode("utf-8"),
b'\xd0\x9f\xd0\xb8\xd1\x82\xd0\xbe\xd0\xbd'
)
self.assertEq... | 1,191 | 44 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/mp_fork_bomb.py | import multiprocessing, sys
def foo():
print("123")
# Because "if __name__ == '__main__'" is missing this will not work
# correctly on Windows. However, we should get a RuntimeError rather
# than the Windows equivalent of a fork bomb.
if len(sys.argv) > 1:
multiprocessing.set_start_method(sys.argv[1])
else:... | 448 | 19 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_contains.py | from collections import deque
import unittest
class base_set:
def __init__(self, el):
self.el = el
class myset(base_set):
def __contains__(self, el):
return self.el == el
class seq(base_set):
def __getitem__(self, n):
return [self.el][n]
class TestContains(unittest.TestCase):
... | 3,569 | 115 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/time_hashlib.py | # It's intended that this script be run by hand. It runs speed tests on
# hashlib functions; it does not test for correctness.
import sys
import time
import hashlib
def creatorFunc():
raise RuntimeError("eek, creatorFunc not overridden")
def test_scaled_msg(scale, name):
iterations = 106201//scale * 20
... | 2,895 | 89 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/coding20731.py | #coding:latin1
| 18 | 5 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_opcodes.py | # Python test set -- part 2, opcodes
import unittest
from test import ann_module, support
class OpcodeTest(unittest.TestCase):
def test_try_inside_for_loop(self):
n = 0
for i in range(10):
n = n+i
try: 1/0
except NameError: pass
except ZeroDivisionE... | 3,765 | 140 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_rlcompleter.py | import unittest
from unittest.mock import patch
import builtins
import rlcompleter
class CompleteMe:
""" Trivial class used in testing rlcompleter.Completer. """
spam = 1
_ham = 2
class TestRlcompleter(unittest.TestCase):
def setUp(self):
self.stdcompleter = rlcompleter.Completer()
se... | 6,449 | 142 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_crypt.py | import sys
from test import support
import unittest
crypt = support.import_module('crypt')
if sys.platform.startswith('openbsd'):
raise unittest.SkipTest('The only supported method on OpenBSD is Blowfish')
class CryptTestCase(unittest.TestCase):
def test_crypt(self):
cr = crypt.crypt('mypassword')
... | 1,539 | 46 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_errno.py | """Test the errno module
Roger E. Masse
"""
import errno
import unittest
std_c_errors = frozenset(['EDOM', 'ERANGE'])
class ErrnoAttributeTests(unittest.TestCase):
def test_for_improper_attributes(self):
# No unexpected attributes should be on the module.
for error_code in std_c_errors:
... | 1,069 | 36 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_bufio.py | import unittest
from test import support
import io # C implementation.
import _pyio as pyio # Python implementation.
# Simple test to ensure that optimizations in the IO library deliver the
# expected results. For best testing, run this under a debug-build Python too
# (to exercise asserts in the C code).
lengths =... | 2,597 | 74 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_dictviews.py | import collections
import copy
import pickle
import sys
import cosmo
import unittest
class DictSetTest(unittest.TestCase):
def test_constructors_not_callable(self):
kt = type({}.keys())
self.assertRaises(TypeError, kt, {})
self.assertRaises(TypeError, kt)
it = type({}.items())
... | 12,074 | 295 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/badsyntax_future5.py | """This is a test"""
from __future__ import nested_scopes
import foo
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
| 184 | 13 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_bytes.py | """Unit tests for the bytes and bytearray types.
XXX This is a mess. Common tests should be unified with string_tests.py (and
the latter should be modernized).
"""
import array
import os
import re
import sys
import copy
import cosmo
import functools
import pickle
import tempfile
import unittest
import test.support
... | 69,981 | 1,835 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/cmath_testcases.txt | -- Testcases for functions in cmath.
--
-- Each line takes the form:
--
-- <testid> <function> <input_value> -> <output_value> <flags>
--
-- where:
--
-- <testid> is a short name identifying the test,
--
-- <function> is the function to be tested (exp, cos, asinh, ...),
--
-- <input_value> is a pair of floats sep... | 144,432 | 2,512 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_spwd.py | import os
import unittest
from test import support
spwd = support.import_module('spwd')
@unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() == 0,
'root privileges required')
class TestSpwdRoot(unittest.TestCase):
def test_getspall(self):
entries = spwd.getspall()
se... | 2,774 | 74 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/revocation.crl | -----BEGIN X509 CRL-----
MIICJjCBjwIBATANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJYWTEmMCQGA1UE
CgwdUHl0aG9uIFNvZnR3YXJlIEZvdW5kYXRpb24gQ0ExFjAUBgNVBAMMDW91ci1j
YS1zZXJ2ZXIXDTE4MDgyOTE0MjMxNloXDTI4MDcwNzE0MjMxNlqgDjAMMAoGA1Ud
FAQDAgEAMA0GCSqGSIb3DQEBCwUAA4IBgQCPhrtGSbuvxPAI3YWQFDB4iOWdBnVk
ugW1lsifmCsE86FfID0EwUut1SRHlksltMt... | 800 | 15 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/exception_hierarchy.txt | BaseException
+-- SystemExit
+-- KeyboardInterrupt
+-- GeneratorExit
+-- Exception
+-- StopIteration
+-- StopAsyncIteration
+-- ArithmeticError
| +-- FloatingPointError
| +-- OverflowError
| +-- ZeroDivisionError
+-- AssertionError
+-- AttributeError
+-... | 1,822 | 65 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/zipdir.zip | PK
ýº%: a/UT }bIbIUx èèPK
»%: a/b/UT bIbIUx èèPK
»%: a/b/cUT bIbIUx èèPK
ýº%:
íA a/UT }bIUx PK
»%:
íA5 a/b/UT bIUx PK
»%:
... | 374 | 10 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_openpty.py | # Test to see if openpty works. (But don't worry if it isn't available.)
import os, unittest
if not hasattr(os, "openpty"):
raise unittest.SkipTest("os.openpty() not available.")
class OpenptyTest(unittest.TestCase):
def test(self):
master, slave = os.openpty()
self.addCleanup(os.close, mast... | 600 | 22 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_xml_etree_c.py | # xml.etree test for cElementTree
import struct
from test import support
from test.support import import_fresh_module
import types
import unittest
from encodings import (
aliases,
base64_codec,
big5,
big5hkscs,
bz2_codec,
charmap,
cp037,
cp1006,
cp1026,
cp1125,
cp1140,
c... | 8,652 | 333 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_platform.py | from unittest import mock
import os
import platform
import subprocess
import sys
import sysconfig
import tempfile
import unittest
import warnings
from test import support
class PlatformTest(unittest.TestCase):
def test_architecture(self):
res = platform.architecture()
@support.skip_unless_symlink
... | 17,058 | 419 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_extcall.py |
"""Doctest for method/function calls.
We're going the use these types for extra testing
>>> from collections import UserList
>>> from collections import UserDict
We're defining four helper functions
>>> def e(a,b):
... print(a, b)
>>> def f(*a, **k):
... print(a, support.sortdict(k... | 12,380 | 466 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/badsyntax_future7.py | """This is a test"""
from __future__ import nested_scopes; import string; from __future__ import \
nested_scopes
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
| 196 | 12 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_abc.py | # Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Unit tests for abc.py."""
import unittest
from test import support
import abc
from inspect import isabstract
class TestLegacyAPI(unittest.TestCase):
def test_abstractproperty_basics(self):
@abc.abstr... | 14,088 | 421 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_grp.py | """Test script for the grp module."""
import unittest
from test import support
grp = support.import_module('grp')
class GroupDatabaseTestCase(unittest.TestCase):
def check_value(self, value):
# check that a grp tuple has the entries and
# attributes promised by the docs
self.assertEqual(... | 3,628 | 109 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_compileall.py | import sys
import compileall
import importlib.util
import test.test_importlib.util
import os
import pathlib
import py_compile
import shutil
import struct
import tempfile
import time
import unittest
import io
from unittest import mock, skipUnless
try:
from concurrent.futures import ProcessPoolExecutor
_have_mul... | 23,386 | 548 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_codecencodings_tw.py | #
# test_codecencodings_tw.py
# Codec encoding tests for ROC encodings.
#
from test import multibytecodec_support
import unittest
class Test_Big5(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'big5'
tstring = multibytecodec_support.load_teststring('big5')
codectests = (
# inval... | 681 | 23 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_urllib2_localnet.py | import base64
import os
import email
import urllib.parse
import urllib.request
import http.server
import unittest
import hashlib
from test import support
threading = support.import_module('threading')
try:
import ssl
except ImportError:
ssl = None
here = os.path.dirname(__file__)
# Self-signed cert file for... | 25,073 | 680 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_pyexpat.py | # XXX TypeErrors on calling handlers, or on bad return values from a
# handler, are obscure and unhelpful.
from io import BytesIO
import os
import sys
import sysconfig
import unittest
import traceback
from xml.parsers import expat
from xml.parsers.expat import errors
from test.support import sortdict
class SetAttr... | 27,178 | 735 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_uu.py | """
Tests for uu module.
Nick Mathewson
"""
import unittest
from test import support
import sys
import uu
import io
plaintext = b"The smooth-scaled python crept over the sleeping dog\n"
encodedtext = b"""\
M5&AE('-M;V]T:\"US8V%L960@<'ET:&]N(&-R97!T(&]V97(@=&AE('-L965P
(:6YG(&1O9PH """
# Stolen from io.py
class Fak... | 6,875 | 219 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/xmltests.py | # Convenience test module to run all of the XML-related tests in the
# standard library.
import sys
import test.support
test.support.verbose = 0
def runtest(name):
__import__(name)
module = sys.modules[name]
if hasattr(module, "test_main"):
module.test_main()
runtest("test.test_minidom")
runtest... | 499 | 22 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/BIG5.TXT | #
# Name: BIG5 to Unicode table (complete)
# Unicode version: 1.1
# Table version: 1.0
# Table format: Format A
# Date: 2011 October 14
#
# Copyright (c) 1994-2011 Unicode, Inc. All Rights reserved.
#
# This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
# No claims a... | 141,327 | 13,809 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_ordered_dict.py | import builtins
import contextlib
import copy
import gc
import pickle
from random import randrange, shuffle
import struct
import sys
import unittest
import weakref
from collections.abc import MutableMapping
from test import mapping_tests, support
py_coll = support.import_fresh_module('collections', blocked=['_collect... | 29,916 | 823 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_gzip.py | """Test script for the gzip module.
"""
import array
import functools
import io
import os
import pathlib
import struct
import sys
import unittest
from encodings import utf_16
from subprocess import PIPE, Popen
from test import support
from test.support import _4G, bigmemtest
from test.support.script_helper import asse... | 27,791 | 765 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_imaplib.py | from test import support
# If we end up with a significant number of tests that don't require
# threading, this test module should be split. Right now we skip
# them all if we don't have threading.
threading = support.import_module('threading')
from contextlib import contextmanager
import errno
import imaplib
import ... | 39,506 | 1,013 | jart/cosmopolitan | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.