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/ann_module2.py | """
Some correct syntax for variable annotation here.
More examples are in test_grammar and test_parser.
"""
from typing import no_type_check, ClassVar
i: int = 1
j: int
x: float = i/10
def f():
class C: ...
return C()
f().new_attr: object = object()
class C:
def __init__(self, x: int) -> None:
... | 519 | 37 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/ssl_cert.pem | -----BEGIN CERTIFICATE-----
MIIEWTCCAsGgAwIBAgIJAJinz4jHSjLtMA0GCSqGSIb3DQEBCwUAMF8xCzAJBgNV
BAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEjMCEGA1UECgwaUHl0aG9u
IFNvZnR3YXJlIEZvdW5kYXRpb24xEjAQBgNVBAMMCWxvY2FsaG9zdDAeFw0xODA4
MjkxNDIzMTVaFw0yODA4MjYxNDIzMTVaMF8xCzAJBgNVBAYTAlhZMRcwFQYDVQQH
DA5DYXN0bGUgQW50aHJheDEjMCEGA1UE... | 1,570 | 27 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_lib2to3.py | from lib2to3.tests import load_tests
import unittest
if __name__ == '__main__':
unittest.main()
| 101 | 6 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_flufl.py | import __future__
import unittest
class FLUFLTests(unittest.TestCase):
def test_barry_as_bdfl(self):
code = "from __future__ import barry_as_FLUFL\n2 {0} 3"
compile(code.format('<>'), '<BDFL test>', 'exec',
__future__.CO_FUTURE_BARRY_AS_BDFL)
with self.assertRaises(SyntaxEr... | 1,347 | 34 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_generator_stop.py | from __future__ import generator_stop
import unittest
class TestPEP479(unittest.TestCase):
def test_stopiteration_wrapping(self):
def f():
raise StopIteration
def g():
yield f()
with self.assertRaisesRegex(RuntimeError,
"generato... | 943 | 35 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_codecmaps_jp.py | #
# test_codecmaps_jp.py
# Codec mapping tests for Japanese encodings
#
from test import multibytecodec_support
import unittest
class TestCP932Map(multibytecodec_support.TestBase_Mapping,
unittest.TestCase):
encoding = 'cp932'
mapfileurl = '/zip/.python/test/CP932.TXT'
supmaps = [
... | 1,664 | 61 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_unpack.py | doctests = """
Unpack tuple
>>> t = (1, 2, 3)
>>> a, b, c = t
>>> a == 1 and b == 2 and c == 3
True
Unpack list
>>> l = [4, 5, 6]
>>> a, b, c = l
>>> a == 4 and b == 5 and c == 6
True
Unpack implied tuple
>>> a, b, c = 7, 8, 9
>>> a == 7 and b == 8 and c == 9
True
Unpa... | 3,068 | 152 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_int_literal.py | """Test correct treatment of hex/oct constants.
This is complex because of changes due to PEP 237.
"""
import unittest
class TestHexOctBin(unittest.TestCase):
def test_hex_baseline(self):
# A few upper/lowercase tests
self.assertEqual(0x0, 0X0)
self.assertEqual(0x1, 0X1)
self.ass... | 7,053 | 144 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_code.py | """This module includes tests of the code object representation.
>>> def f(x):
... def g(y):
... return x + y
... return g
...
>>> dump(f.__code__)
name: f
argcount: 1
kwonlyargcount: 0
names: ()
varnames: ('x', 'g')
cellvars: ('x',)
freevars: ()
nlocals: 2
flags: 3
consts: ('None', '<code object g>',... | 10,876 | 374 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/win_console_handler.py | """Script used to test os.kill on Windows, for issue #1220212
This script is started as a subprocess in test_os and is used to test the
CTRL_C_EVENT and CTRL_BREAK_EVENT signals, which requires a custom handler
to be written into the kill target.
See http://msdn.microsoft.com/en-us/library/ms685049%28v=VS.85%29.aspx ... | 1,416 | 50 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_ntpath.py | import ntpath
import os
import sys
import unittest
import warnings
from test.support import TestFailed, FakePath
from test import support, test_genericpath
from tempfile import TemporaryFile
def tester(fn, wantResult):
fn = fn.replace("\\", "\\\\")
gotResult = eval(fn)
if wantResult != gotResult:
... | 24,478 | 537 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_httplib.py | import errno
from http import client
import io
import itertools
import os
import array
import socket
import unittest
TestCase = unittest.TestCase
from test import support
here = os.path.dirname(__file__)
# Self-signed cert file for 'localhost'
CERT_localhost = os.path.join(here, 'keycert.pem')
# Self-signed cert fil... | 75,800 | 1,994 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/tokenize_tests-latin1-coding-cookie-and-utf8-bom-sig.txt | # -*- coding: latin1 -*-
# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf'
# at the start of it. Make sure this is preserved if any changes
# are made! Also note that the coding cookie above conflicts with
# the presence of a utf-8 BOM signature -- this is intended.
# Arbitrary encoded utf-8 text... | 444 | 14 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_univnewlines.py | # Tests universal newline support for both reading and parsing files.
import io
import _pyio as pyio
import unittest
import os
import sys
from test import support
if not hasattr(sys.stdin, 'newlines'):
raise unittest.SkipTest(
"This Python does not have universal newline support")
FATX = 'x' * (2**14)
DA... | 3,922 | 124 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_nntplib.py | import io
import socket
import datetime
import textwrap
import unittest
import functools
import contextlib
import os.path
import re
from test import support
from nntplib import NNTP, GroupInfo
import nntplib
from unittest.mock import patch
try:
import ssl
except ImportError:
ssl = None
try:
import _thread
... | 63,218 | 1,609 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_structmembers.py | import unittest
from test import support
# Skip this test if the _testcapi module isn't available.
support.import_module('_testcapi')
from _testcapi import _test_structmembersType, \
CHAR_MAX, CHAR_MIN, UCHAR_MAX, \
SHRT_MAX, SHRT_MIN, USHRT_MAX, \
INT_MAX, INT_MIN, UINT_MAX, \
LONG_MAX, LONG_MIN, ULON... | 4,816 | 145 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_dbm_gnu.py | from test import support
gdbm = support.import_module("dbm.gnu") #skip if not supported
import unittest
import os
from test.support import TESTFN, TESTFN_NONASCII, unlink
filename = TESTFN
class TestGdbm(unittest.TestCase):
def setUp(self):
self.g = None
def tearDown(self):
if self.g is not ... | 5,344 | 140 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/threaded_import_hangers.py | # This is a helper module for test_threaded_import. The test imports this
# module, and this module tries to run various Python library functions in
# their own thread, as a side effect of being imported. If the spawned
# thread doesn't complete in TIMEOUT seconds, an "appeared to hang" message
# is appended to the m... | 1,484 | 46 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_genexps.py | doctests = """
Test simple loop with conditional
>>> sum(i*i for i in range(100) if i&1 == 1)
166650
Test simple nesting
>>> list((i,j) for i in range(3) for j in range(4) )
[(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)]
Test nesting with the inner ... | 7,286 | 286 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_httpservers.py | """Unittests for the various HTTPServer modules.
Written by Cody A.W. Somerville <cody-somerville@ubuntu.com>,
Josip Dzolonga, and Michael Otteneder for the 2007/08 GHOP contest.
"""
from http.server import BaseHTTPRequestHandler, HTTPServer, \
SimpleHTTPRequestHandler, CGIHTTPRequestHandler
from http import ser... | 41,021 | 1,061 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/recursion.tar | bcaller 0 0 0 1 0 002755 g 00 ... | 516 | 1 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_trace.py | import os
import sys
import cosmo
from test.support import TESTFN, rmtree, unlink, captured_stdout
from test.support.script_helper import assert_python_ok, assert_python_failure
import textwrap
import unittest
import trace
from trace import Trace
from test.tracedmodules import testmod
#------------------------------... | 16,565 | 447 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_subprocess.py | import unittest
from unittest import mock
from test import support
import subprocess
import sys
import platform
import signal
import io
import itertools
import os
import errno
import tempfile
import time
import selectors
import sysconfig
import select
import shutil
import gc
import textwrap
from test.support import Fak... | 131,204 | 3,083 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_inspect.py | import builtins
import collections
import datetime
import functools
import importlib
import inspect
import io
import linecache
import os
from os.path import normcase
import _pickle
import pickle
import re
import shutil
import sys
import types
import textwrap
import unicodedata
import unittest
import unittest.mock
impor... | 144,729 | 3,765 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_binascii.py | """Test the binascii C module."""
import unittest
import binascii
import array
# Note: "*_hex" functions are aliases for "(un)hexlify"
b2a_functions = ['b2a_base64', 'b2a_hex', 'b2a_hqx', 'b2a_qp', 'b2a_uu',
'hexlify', 'rlecode_hqx']
a2b_functions = ['a2b_base64', 'a2b_hex', 'a2b_hqx', 'a2b_qp', 'a2b... | 15,298 | 374 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/nullcert.pem | 0 | 1 | jart/cosmopolitan | false | |
cosmopolitan/third_party/python/Lib/test/test_filecmp.py | import filecmp
import os
import shutil
import tempfile
import unittest
from test import support
class FileCompareTestCase(unittest.TestCase):
def setUp(self):
self.name = support.TESTFN
self.name_same = support.TESTFN + '-same'
self.name_diff = support.TESTFN + '-diff'
data = 'Con... | 8,894 | 218 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_queue.py | # Some simple queue module tests, plus some failure conditions
# to ensure the Queue locks remain stable.
import queue
import time
import unittest
from test import support
threading = support.import_module('threading')
QUEUE_SIZE = 5
def qfull(q):
return q.maxsize > 0 and q.qsize() == q.maxsize
# A thread to run... | 13,175 | 363 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_shutil.py | # Copyright (C) 2003 Python Software Foundation
import unittest
import unittest.mock
import shutil
import tempfile
import sys
import stat
import os
import os.path
import errno
import functools
import pathlib
import subprocess
from contextlib import ExitStack
from shutil import (make_archive,
regist... | 77,263 | 1,935 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/ssl_key.pem | -----BEGIN PRIVATE KEY-----
MIIG/wIBADANBgkqhkiG9w0BAQEFAASCBukwggblAgEAAoIBgQCylKlLaKU+hOvJ
DfriTRLd+IthG5hv28I3A/CGjLICT0rDDtgaXd0uqloJAnjsgn5gMAcStpDW8Rm+
t6LsrBL+5fBgkyU1r94Rvx0HHoyaZwBBouitVHw28hP3W+smddkqB1UxpGnTeL2B
gj3dVo/WTtRfO+0h0PKw1l98YE1pMTdqIwcOOE/ER0g4hvA/wrxuLhMvlVLMy/lL
58uctqaDUqryNyeerKbVkq4fJyCG5D2T... | 2,488 | 41 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_winsound.py | # Ridiculously simple test of the winsound module for Windows.
import functools
import os
import subprocess
import time
import unittest
from test import support
support.requires('audio')
winsound = support.import_module('winsound')
# Unless we actually have an ear in the room, we have no idea whether a sound
# act... | 4,705 | 151 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_dbm.py | """Test script for the dbm.open function based on testdumbdbm.py"""
import unittest
import glob
import test.support
# Skip tests if dbm module doesn't exist.
dbm = test.support.import_module('dbm')
try:
from dbm import ndbm
except ImportError:
ndbm = None
_fname = test.support.TESTFN
#
# Iterates over ever... | 6,590 | 213 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/badcert.pem | -----BEGIN RSA PRIVATE KEY-----
MIICXwIBAAKBgQC8ddrhm+LutBvjYcQlnH21PPIseJ1JVG2HMmN2CmZk2YukO+9L
opdJhTvbGfEj0DQs1IE8M+kTUyOmuKfVrFMKwtVeCJphrAnhoz7TYOuLBSqt7lVH
fhi/VwovESJlaBOp+WMnfhcduPEYHYx/6cnVapIkZnLt30zu2um+DzA9jQIDAQAB
AoGBAK0FZpaKj6WnJZN0RqhhK+ggtBWwBnc0U/ozgKz2j1s3fsShYeiGtW6CK5nU
D1dZ5wzhbGThI7LiOXDvRucc9n7v... | 1,928 | 37 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/pycacert.pem | Certificate:
Data:
Version: 3 (0x2)
Serial Number:
cb:2d:80:99:5a:69:52:5b
Signature Algorithm: sha256WithRSAEncryption
Issuer: C=XY, O=Python Software Foundation CA, CN=our-ca-server
Validity
Not Before: Aug 29 14:23:16 2018 GMT
Not After : Au... | 5,656 | 100 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_posix.py | "Test posix functions"
from test import support
# Skip these tests if there is no posix module.
posix = support.import_module('posix')
import errno
import sys
import time
import os
import platform
import pwd
import stat
import tempfile
import unittest
import warnings
_DUMMY_SYMLINK = os.path.join(tempfile.gettempdi... | 56,934 | 1,372 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_bdb.py | """ Test the bdb module.
A test defines a list of tuples that may be seen as paired tuples, each
pair being defined by 'expect_tuple, set_tuple' as follows:
([event, [lineno[, co_name[, eargs]]]]), (set_type, [sargs])
* 'expect_tuple' describes the expected current state of the Bdb instance.
... | 42,199 | 1,155 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/mp_preload.py | import multiprocessing
multiprocessing.Lock()
def f():
print("ok")
if __name__ == "__main__":
ctx = multiprocessing.get_context("forkserver")
modname = "test.mp_preload"
# Make sure it's importable
__import__(modname)
ctx.set_forkserver_preload([modname])
proc = ctx.Process(target=f)
... | 351 | 19 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_set.py | import unittest
from test import support
import gc
import weakref
import operator
import copy
import pickle
from random import randrange, shuffle
import warnings
import collections
import collections.abc
import itertools
import string
class PassThru(Exception):
pass
def check_pass_thru():
raise PassThru
y... | 65,777 | 1,904 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_unicode_file.py | # Test some Unicode file name semantics
# We dont test many operations on files other than
# that their names can be used with Unicode characters.
import os, glob, time, shutil
import unicodedata
import unittest
from test.support import (run_unittest, rmtree, change_cwd,
TESTFN_ENCODING, TESTFN_UNICODE, TESTFN_UNE... | 5,915 | 140 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_exceptions.py | # Python test set -- part 5, built-in exceptions
import os
import sys
import copy
import cosmo
import unittest
import pickle
import weakref
import errno
from test.support import (TESTFN, captured_stderr, check_impl_detail,
check_warnings, cpython_only, gc_collect, run_unittest,
... | 47,823 | 1,296 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/re_tests.py | #!/usr/bin/env python3
# -*- mode: python -*-
# Re test suite and benchmark suite v1.5
# The 3 possible outcomes for each pattern
[SUCCEED, FAIL, SYNTAX_ERROR] = range(3)
# Benchmark suite (needs expansion)
#
# The benchmark suite does not test correctness, just speed. The
# first element of each tuple is the regex... | 31,791 | 671 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/badsyntax_future9.py | """This is a test"""
from __future__ import nested_scopes, braces
def f(x):
def g(y):
return x + y
return g
print(f(2)(4))
| 142 | 11 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_http_cookiejar.py | """Tests for http/cookiejar.py."""
import os
import re
import test.support
import time
import unittest
import urllib.request
from http.cookiejar import (time2isoz, http2time, iso2time, time2netscape,
parse_ns_headers, join_header_words, split_header_words, Cookie,
CookieJar, DefaultCookiePolicy, LWPCookieJa... | 76,958 | 1,838 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_cmath.py | from test.support import requires_IEEE_754, cpython_only
from test.test_math import parse_testfile, test_file
import test.test_math as test_math
import unittest
import cmath, math
from cmath import phase, polar, rect, pi
import platform
import sys
import sysconfig
INF = float('inf')
NAN = float('nan')
complex_zeros =... | 24,858 | 644 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/badsyntax_future8.py | """This is a test"""
from __future__ import *
def f(x):
def g(y):
return x + y
return g
print(f(2)(4))
| 122 | 11 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_copy.py | """Unit tests for the copy module."""
import cosmo
import copy
import copyreg
import weakref
import abc
from operator import le, lt, ge, gt, eq, ne
import unittest
order_comparisons = le, lt, ge, gt
equality_comparisons = eq, ne
comparisons = order_comparisons + equality_comparisons
class TestCopy(unittest.TestCase... | 26,631 | 893 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_plistlib.py | # Copyright (C) 2003-2013 Python Software Foundation
import cosmo
import struct
import unittest
import plistlib
import os
import datetime
import codecs
import binascii
import collections
from test import support
from io import BytesIO
ALL_FORMATS=(plistlib.FMT_XML, plistlib.FMT_BINARY)
# The testdata is generated us... | 38,193 | 972 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_types.py | # Python test set -- part 6, built-in types
from test.support import run_with_locale
import collections.abc
import inspect
import pickle
import locale
import sys
import types
import unittest.mock
import weakref
class TypesTests(unittest.TestCase):
def test_truth_values(self):
if None: self.fail('None is ... | 55,414 | 1,551 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/gb-18030-2000.ucm | 0000 00
0001 01
0002 02
0003 03
0004 04
0005 05
0006 06
0007 07
0008 08
0009 09
000A 0A
000B 0B
000C 0C
000D 0D
000E 0E
000F 0F
0010 10
0011 11
0012 12
0013 13
0014 14
0015 15
0016 16
0017 17
0018 18
0019 19
001A 1A
001B 1B
001C 1C
001D 1D
001E 1E
001F 1F
0020 20
0021 21
0022 22
0023 23
0024 24
0025 25
0026 26
0027 27
... | 379,845 | 30,862 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_stat.py | import unittest
import os
import sys
from test.support import TESTFN, import_fresh_module
c_stat = import_fresh_module('stat', fresh=['_stat'])
assert c_stat
class TestFilemode:
statmod = None
file_flags = {'SF_APPEND', 'SF_ARCHIVED', 'SF_IMMUTABLE', 'SF_NOUNLINK',
'SF_SNAPSHOT', 'UF_APPEN... | 8,222 | 235 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/string_tests.py | """
Common tests shared by test_unicode, test_userstring and test_bytes.
"""
import unittest, string, sys, struct
from test import support
from collections import UserList
class Sequence:
def __init__(self, seq='wxyz'): self.seq = seq
def __len__(self): return len(self.seq)
def __getitem__(self, i): retur... | 65,442 | 1,384 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/imp_dummy.py | # Fodder for test of issue24748 in test_imp
dummy_name = True
| 63 | 4 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_string.py | import unittest
import string
from string import Template
class ModuleTest(unittest.TestCase):
def test_attrs(self):
# While the exact order of the items in these attributes is not
# technically part of the "language spec", in practice there is almost
# certainly user code that depends on... | 18,532 | 440 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_posixpath.py | import sys
import os
import posixpath
import unittest
import warnings
from posixpath import realpath, abspath, dirname, basename
from test import support, test_genericpath
from test.support import FakePath
from unittest import mock
try:
import posix
except ImportError:
posix = None
# An absolute path to a tem... | 29,438 | 688 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_descrtut.py | # This contains most of the executable examples from Guido's descr
# tutorial, once at
#
# http://www.python.org/2.2/descrintro.html
#
# A few examples left implicit in the writeup were fleshed out, a few were
# skipped due to lack of interest (e.g., faking super() by hand isn't
# of much interest anymore), and a f... | 11,804 | 487 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_configparser.py | import collections
import configparser
import io
import os
import pathlib
import textwrap
import unittest
import warnings
from test import support
class SortedDict(collections.UserDict):
def items(self):
return sorted(self.data.items())
def keys(self):
return sorted(self.data.keys())
d... | 85,021 | 2,098 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_weakref.py | import gc
import sys
import unittest
import collections
import weakref
import operator
import contextlib
import copy
import time
from test import support
from test.support import script_helper
# Used in ReferencesTestCase.test_ref_created_during_del() .
ref_from_del = None
# Used by FinalizeTestCase as a global that... | 66,404 | 1,956 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/cfgparser.3 | # INI with as many tricky parts as possible
# Most of them could not be used before 3.2
# This will be parsed with the following options
# delimiters = {'='}
# comment_prefixes = {'#'}
# allow_no_value = True
[DEFAULT]
go = %(interpolate)s
[strange]
values = that are indented # and end with ... | 1,587 | 70 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/memory_watchdog.py | """Memory watchdog: periodically read the memory usage of the main test process
and print it out, until terminated."""
# stdin should refer to the process' /proc/<PID>/statm: we don't pass the
# process' PID to avoid a race condition in case of - unlikely - PID recycling.
# If the process crashes, reading from the /pro... | 859 | 29 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test__osx_support.py | """
Test suite for _osx_support: shared OS X support functions.
"""
import os
import platform
import stat
import sys
import unittest
import test.support
import _osx_support
@unittest.skipUnless(sys.platform.startswith("darwin"), "requires OS X")
class Test_OSXSupport(unittest.TestCase):
def setUp(self):
... | 11,683 | 277 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_cosmo.py | import os
import shutil
import tempfile
import unittest
import subprocess
class SubprocessTest(unittest.TestCase):
def test_execve(self):
tmp_dir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmp_dir)
exe = os.path.join(tmp_dir, 'hello.com')
shutil.copyfile('/zip/.python/test... | 614 | 23 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_exception_variations.py |
import unittest
class ExceptionTestCase(unittest.TestCase):
def test_try_except_else_finally(self):
hit_except = False
hit_else = False
hit_finally = False
try:
raise Exception('nyaa!')
except:
hit_except = True
else:
hit_else = ... | 3,948 | 177 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/__main__.py | from test.libregrtest import main
main()
| 41 | 3 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test___future__.py | import unittest
import __future__
GOOD_SERIALS = ("alpha", "beta", "candidate", "final")
features = __future__.all_feature_names
class FutureTest(unittest.TestCase):
def test_names(self):
# Verify that all_feature_names appears correct.
given_feature_names = features[:]
for name in dir(_... | 2,421 | 62 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/testcodec.py | """ Test Codecs (used by test_charmapcodec)
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright 2000 Guido van Rossum.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def deco... | 1,046 | 49 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_listcomps.py | doctests = """
########### Tests borrowed from or inspired by test_genexps.py ############
Test simple loop with conditional
>>> sum([i*i for i in range(100) if i&1 == 1])
166650
Test simple nesting
>>> [(i,j) for i in range(3) for j in range(4)]
[(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, ... | 3,853 | 149 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/seq_tests.py | """
Tests common to tuple, list and UserList.UserList
"""
import unittest
import sys
import pickle
from test import support
# Various iterables
# This is used for checking the constructor (here and in test_deque.py)
def iterfunc(seqn):
'Regular generator'
for i in seqn:
yield i
class Sequence:
'S... | 14,395 | 415 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_fork1.py | """This test checks for correct fork() behavior.
"""
import _imp as imp
import os
import signal
import sys
import time
import unittest
from test.fork_wait import ForkWait
from test.support import (reap_children, get_attribute,
import_module, verbose)
threading = import_module('threading')
... | 3,826 | 113 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_codecmaps_tw.py | #
# test_codecmaps_tw.py
# Codec mapping tests for ROC encodings
#
from test import multibytecodec_support
import unittest
class TestBIG5Map(multibytecodec_support.TestBase_Mapping,
unittest.TestCase):
encoding = 'big5'
mapfileurl = '/zip/.python/test/BIG5.TXT'
class TestCP950Map(multibyt... | 673 | 28 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_longexp.py | import unittest
class LongExpText(unittest.TestCase):
def test_longexp(self):
REPS = 65580
l = eval("[" + "2," * REPS + "]")
self.assertEqual(len(l), REPS)
if __name__ == "__main__":
unittest.main()
| 233 | 11 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/ieee754.txt | ======================================
Python IEEE 754 floating point support
======================================
>>> from sys import float_info as FI
>>> from math import *
>>> PI = pi
>>> E = e
You must never compare two floats with == because you are not going to get
what you expect. We treat two floats as equa... | 3,283 | 186 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_builtin.py | # Python test set -- built-in functions
import ast
import builtins
import cosmo
import collections
import decimal
import fractions
import io
import locale
import os
import pickle
import platform
import random
import re
import sys
import traceback
import types
import unittest
import warnings
from operator import neg
fr... | 67,391 | 1,866 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_telnetlib.py | import socket
import selectors
import telnetlib
import contextlib
from test import support
import unittest
threading = support.import_module('threading')
HOST = support.HOST
def server(evt, serv):
serv.listen()
evt.set()
try:
conn, addr = serv.accept()
conn.close()
except socket.timeo... | 13,033 | 402 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_fnmatch.py | """Test cases for the fnmatch module."""
import unittest
import os
from fnmatch import fnmatch, fnmatchcase, translate, filter
class FnmatchTestCase(unittest.TestCase):
def check_match(self, filename, pattern, should_match=True, fn=fnmatch):
if should_match:
self.assertTrue(fn(filename, patt... | 4,807 | 129 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_zipfile.py | import contextlib
import io
import os
import importlib.util
import pathlib
import posixpath
import time
import struct
import zipfile
import unittest
from tempfile import TemporaryFile
from random import randint, random, getrandbits
from test.support import script_helper
from test.support import (TESTFN, findfile, un... | 91,102 | 2,257 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test__opcode.py | import dis
from test.support import import_module
import unittest
_opcode = import_module("_opcode")
class OpcodeTests(unittest.TestCase):
def test_stack_effect(self):
self.assertEqual(_opcode.stack_effect(dis.opmap['POP_TOP']), -1)
self.assertEqual(_opcode.stack_effect(dis.opmap['DUP_TOP_TWO']),... | 850 | 21 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_dbm_dumb.py | """Test script for the dumbdbm module
Original by Roger E. Masse
"""
import io
import operator
import os
import stat
import unittest
import warnings
import dbm.dumb as dumbdbm
from test import support
from functools import partial
_fname = support.TESTFN
def _delete_files():
for ext in [".dir", ".dat", ".bak"... | 10,417 | 311 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_http_cookies.py | # Simple test suite for http/cookies.py
import copy
from test.support import run_unittest, run_doctest, check_warnings
import unittest
from http import cookies
import pickle
import warnings
class CookieTests(unittest.TestCase):
def setUp(self):
self._warnings_manager = check_warnings()
self._warn... | 18,968 | 483 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_index.py | import unittest
from test import support
import operator
maxsize = support.MAX_Py_ssize_t
class newstyle:
def __index__(self):
return self.ind
class TrapInt(int):
def __index__(self):
return int(self)
class BaseTestCase(unittest.TestCase):
def setUp(self):
self.o = newstyle()
... | 8,567 | 276 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
from test import support
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import tempfile
import urllib.request
import traceback
import asyncore
import weakref
import platform
import re
import functo... | 178,294 | 3,979 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_yield_from.py | # -*- coding: utf-8 -*-
"""
Test suite for PEP 380 implementation
adapted from original tests written by Greg Ewing
see <http://www.cosc.canterbury.ac.nz/greg.ewing/python/yield-from/YieldFrom-Python3.1.2-rev5.zip>
"""
import unittest
import io
import sys
import inspect
import parser
from test.support import captur... | 30,729 | 1,053 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_startfile.py | # Ridiculously simple test of the os.startfile function for Windows.
#
# empty.vbs is an empty file (except for a comment), which does
# nothing when run with cscript or wscript.
#
# A possible improvement would be to have empty.vbs do something that
# we can detect here, to make sure that not only the os.startfile()
#... | 1,193 | 35 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_pstats.py | import unittest
from test import support
from io import StringIO
import pstats
class AddCallersTestCase(unittest.TestCase):
"""Tests for pstats.add_callers helper."""
def test_combine_results(self):
# pstats.add_callers should combine the call results of both target
# and source by adding th... | 1,197 | 39 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_asdl_parser.py | """Tests for the asdl parser in Parser/asdl.py"""
import importlib.machinery
import os
from os.path import dirname
import sys
import sysconfig
import unittest
if __name__ == "PYOBJ.COM":
import asdl
src_base = dirname(dirname(__file__))
parser_dir = src_base
class TestAsdlParser(unittest.TestCase):
@class... | 3,833 | 121 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/pycakey.pem | -----BEGIN PRIVATE KEY-----
MIIG/AIBADANBgkqhkiG9w0BAQEFAASCBuYwggbiAgEAAoIBgQCX7VVBujYXldtx
HNPhYaxYc+PGls8rH7gI9Z1LS8cw9rgLs1JyoLvJTTuO3yKOAVeByZJzzADG7HCw
OhdAwd/yjDZMxKeB57YkaOKgfjUHL6Bb+UVG9x7wRhH+yho8UPEmqV+cIpz4QeHf
TxKVGS9ckAEXbn4+fc/pCa8l+PhCdy1tXzbyeB59SodoY2wGcRuN+iX+1NP1pRex
7+oXy1TIJ5mAyzxF8SxSHN0fUUUgUB5e... | 2,484 | 41 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_pulldom.py | import io
import unittest
import xml.sax
from xml.sax.xmlreader import AttributesImpl
from xml.sax.handler import feature_external_ges
from xml.dom import pulldom
from test.support import findfile
tstfile = findfile("test.xml", subdir="xmltestdata")
# A handy XML snippet, containing attributes, a namespace prefix,... | 12,628 | 350 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_ttk_textonly.py | from test import support
# Skip this test if _tkinter does not exist.
support.import_module('_tkinter')
from tkinter.test import runtktests
def test_main():
support.run_unittest(
*runtktests.get_tests(gui=False, packages=['test_ttk']))
if __name__ == '__main__':
test_main()
| 299 | 14 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_pickletools.py | import pickle
import pickletools
from test import support
from test.pickletester import AbstractPickleTests
import unittest
class OptimizedPickleTests(AbstractPickleTests):
def dumps(self, arg, proto=None):
return pickletools.optimize(pickle.dumps(arg, proto))
def loads(self, buf, **kwds):
re... | 4,218 | 100 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_raise.py | # Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Tests for the raise statement."""
from test import support
import re
import sys
import types
import unittest
def get_tb():
try:
raise OSError()
except:
return sys.exc_info()[2]
class Cont... | 11,291 | 420 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/badsyntax_3131.py | # -*- coding: utf-8 -*-
⬠= 2
| 32 | 3 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_cmd.py | """
Test script for the 'cmd' module
Original by Michael Schneider
"""
import cmd
import sys
import re
import unittest
import io
from test import support
class samplecmdclass(cmd.Cmd):
"""
Instance the sampleclass:
>>> mycmd = samplecmdclass()
Test for the function parseline():
>>> mycmd.parseli... | 6,259 | 244 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_gettext.py | import os
import base64
import gettext
import locale
import unittest
from test import support
# TODO:
# - Add new tests, for example for "dgettext"
# - Remove dummy tests, for example testing for single and double quotes
# has no sense, it would have if we were testing a parser (i.e. pygettext)
# - Tests shoul... | 33,800 | 773 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_imp.py | try:
import _thread
except ImportError:
_thread = None
import importlib
import importlib.util
import os
import os.path
import sys
from test import support
import unittest
import warnings
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
import imp
def requires_load_dy... | 17,018 | 395 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/bytecode_helper.py | """bytecode_helper - support tools for testing correct bytecode generation"""
import unittest
import dis
import io
_UNSPECIFIED = object()
class BytecodeTestCase(unittest.TestCase):
"""Custom assertion methods for inspecting bytecode."""
def get_disassembly_as_string(self, co):
s = io.StringIO()
... | 1,600 | 42 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_imghdr.py | import imghdr
import io
import os
import pathlib
import unittest
import warnings
from test.support import findfile, TESTFN, unlink
TEST_FILES = (
('python.png', 'png'),
('python.gif', 'gif'),
('python.bmp', 'bmp'),
('python.ppm', 'ppm'),
('python.pgm', 'pgm'),
('python.pbm', 'pbm'),
('pytho... | 4,767 | 141 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_dictcomps.py | import unittest
# For scope testing.
g = "Global variable"
class DictComprehensionTest(unittest.TestCase):
def test_basics(self):
expected = {0: 10, 1: 11, 2: 12, 3: 13, 4: 14, 5: 15, 6: 16, 7: 17,
8: 18, 9: 19}
actual = {k: k + 10 for k in range(10)}
self.assertEqual... | 3,756 | 87 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_io.py | """Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... | 155,859 | 4,170 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/audiotest.au | .snd " mÎ L guido.aiffÔÕÕÔÔÔÔÔÕÔÔÓÓÔÔÔÓÕÖÖ×Ö×ÙÙÙØÙÙÚÙÚÙÚÚÙÙÙÙÙÙÙØØÙØØØØØØ××רØÙØÙÙÙÙÙÚÚÙÙÙÚÚÚÚÚÚÚÛÛÛÛÜÝÜÛÚÚÙØ×ØØ×××ÖÖÖÖÖÖÕÕÔÔÔÕÔÓÒÒÔÔÓÓÓÒÓÒÑÑÑÑÑÐÐÐÐÏÏÏÏÏÐÏÏÏÏÏÏÏÏÏÏÏÏÏÏÐÏÏÏÏÏÎÎÎÏÏÎÎÍÌ·¸A»°Z^½ÓdÎ^Ú¼{a¸¾ìĽÉÈÒÕÈÐ]ØÊßòÏÈÊËÍ¿²Ñ°ÁÄ»ÒÆ½TF·ä2¸¬/Ú£^F«ÊBe;®Ê5¶«{·¬ÀµµÛĺLQÌ^HuãÞÖÐɺ½ÎÁ¹ÝíÞóVONzôgîÊÂÆ¿¹¸¾¿½¿ÏÓÍÐâãÕØ... | 28,144 | 40 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/selfsigned_pythontestdotnet.pem | -----BEGIN CERTIFICATE-----
MIIF9zCCA9+gAwIBAgIUH98b4Fw/DyugC9cV7VK7ZODzHsIwDQYJKoZIhvcNAQEL
BQAwgYoxCzAJBgNVBAYTAlhZMRcwFQYDVQQIDA5DYXN0bGUgQW50aHJheDEYMBYG
A1UEBwwPQXJndW1lbnQgQ2xpbmljMSMwIQYDVQQKDBpQeXRob24gU29mdHdhcmUg
Rm91bmRhdGlvbjEjMCEGA1UEAwwac2VsZi1zaWduZWQucHl0aG9udGVzdC5uZXQw
HhcNMTkwNTA4MDEwMjQzWhcNMjcwNzI0... | 2,130 | 35 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_scratch.py | import os
import sys
import cosmo
import decimal
import unittest
exit1 = cosmo.exit1
class BooTest(unittest.TestCase):
def test_boo(self):
# cosmo.ftrace()
# eval('0')
# exit1()
pass
if __name__ == '__main__':
unittest.main()
| 269 | 18 | jart/cosmopolitan | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.