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_sax.py | # regression test for SAX 2.0
# $Id$
from xml.sax import make_parser, ContentHandler, \
SAXException, SAXReaderNotAvailable, SAXParseException
import unittest
from unittest import mock
try:
make_parser()
except SAXReaderNotAvailable:
# don't try to test this module if we cannot create a par... | 46,672 | 1,340 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/bisect.py | #!/usr/bin/env python3
"""
Command line tool to bisect failing CPython tests.
Find the test_os test method which alters the environment:
./python -m test.bisect --fail-env-changed test_os
Find a reference leak in "test_os", write the list of failing tests into the
"bisect" file:
./python -m test.bisect -o b... | 4,955 | 168 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_pydoc.py | import os
import sys
import builtins
import contextlib
import importlib.util
import inspect
import pydoc
import py_compile
import keyword
import _pickle
import pkgutil
import re
import stat
import string
import test.support
import time
import types
import typing
import unittest
import urllib.parse
import xml.etree
impo... | 44,702 | 1,203 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_textwrap.py | #
# Test suite for the textwrap module.
#
# Original tests written by Greg Ward <gward@python.net>.
# Converted to PyUnit by Peter Hansen <peter@engcorp.com>.
# Currently maintained by Greg Ward.
#
# $Id$
#
import unittest
from textwrap import TextWrapper, wrap, fill, dedent, indent, shorten
class BaseTestCase(unit... | 38,589 | 978 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_threading_local.py | import unittest
from doctest import DocTestSuite
from test import support
import weakref
import gc
# Modules under test
_thread = support.import_module('_thread')
threading = support.import_module('threading')
import _threading_local
class Weak(object):
pass
def target(local, weaklist):
weak = Weak()
lo... | 6,281 | 221 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_resource.py | import contextlib
import sys
import os
import unittest
from test import support
import time
resource = support.import_module('resource')
# This test is checking a few specific problem spots with the resource module.
class ResourceTest(unittest.TestCase):
def test_args(self):
self.assertRaises(TypeError,... | 7,075 | 179 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_dynamicclassattribute.py | # Test case for DynamicClassAttribute
# more tests are in test_descr
import abc
import sys
import unittest
import cosmo
from types import DynamicClassAttribute
class PropertyBase(Exception):
pass
class PropertyGet(PropertyBase):
pass
class PropertySet(PropertyBase):
pass
class PropertyDel(PropertyBase)... | 9,952 | 302 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_slice.py | # tests for slice objects; in particular the indices method.
import itertools
import operator
import sys
import unittest
import weakref
from pickle import loads, dumps
from test import support
def evaluate_slice_index(arg):
"""
Helper function to convert a slice argument to an integer, and raise
TypeErr... | 8,445 | 256 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_macurl2path.py | import macurl2path
import unittest
class MacUrl2PathTestCase(unittest.TestCase):
def test_url2pathname(self):
self.assertEqual(":index.html", macurl2path.url2pathname("index.html"))
self.assertEqual(":bar:index.html", macurl2path.url2pathname("bar/index.html"))
self.assertEqual("foo:bar:ind... | 1,839 | 32 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/sample_doctest.py | """This is a sample module that doesn't really test anything all that
interesting.
It simply has a few tests, some of which succeed and some of which fail.
It's important that the numbers remain constant as another test is
testing the running of these tests.
>>> 2+2
4
"""
def foo():
"""
>>> 2+2
5
... | 1,041 | 77 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_colorsys.py | import unittest
import colorsys
def frange(start, stop, step):
while start <= stop:
yield start
start += step
class ColorsysTest(unittest.TestCase):
def assertTripleEqual(self, tr1, tr2):
self.assertEqual(len(tr1), 3)
self.assertEqual(len(tr2), 3)
self.assertAlmostEqua... | 3,927 | 101 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/pydocfodder.py | """Something just to look at via pydoc."""
import types
class A_classic:
"A classic class."
def A_method(self):
"Method defined in A."
def AB_method(self):
"Method defined in A and B."
def AC_method(self):
"Method defined in A and C."
def AD_method(self):
"Method de... | 6,332 | 217 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_crashers.py | # Tests that the crashers in the Lib/test/crashers directory actually
# do crash the interpreter as expected
#
# If a crasher is fixed, it should be moved elsewhere in the test suite to
# ensure it continues to work correctly.
import unittest
import glob
import os.path
import test.support
from test.support.script_help... | 1,184 | 38 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_dynamic.py | # Test the most dynamic corner cases of Python's runtime semantics.
import builtins
import unittest
from test.support import swap_item, swap_attr
class RebindBuiltinsTests(unittest.TestCase):
"""Test all the ways that we can change/shadow globals/builtins."""
def configure_func(self, func, *args):
... | 4,394 | 139 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/Sine-1000Hz-300ms.aif | FORM ðøAIFFCOMM 8@ @» FLLR Â ... | 61,696 | 1 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_codeccallbacks.py | import codecs
import html.entities
import sys
import test.support
import unicodedata
import unittest
from encodings import raw_unicode_escape
class PosReturn:
# this can be used for configurable callbacks
def __init__(self):
self.pos = 0
def handle(self, exc):
oldpos = self.pos
re... | 43,862 | 1,125 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_codeop.py | """
Test cases for codeop.py
Nick Mathewson
"""
import unittest
from test.support import is_jython
from codeop import compile_command, PyCF_DONT_IMPLY_DEDENT
import io
if is_jython:
import sys
def unify_callables(d):
for n,v in d.items():
if hasattr(v, '__call__'):
d... | 7,550 | 300 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/keycert2.pem | -----BEGIN PRIVATE KEY-----
MIIG/QIBADANBgkqhkiG9w0BAQEFAASCBucwggbjAgEAAoIBgQDKjrjWZlfOs1Ch
qt1RoyLfqyXbHVXIAW0fTzAxfJnxvFOiWqAAKgC2qVQM8Y080kRUuRaXP/w9ywXT
+MzX6tByy5VbTYJYyTjHOH46EWLNdcqEJs4+FCVqOIYrQPQ6pGAhCXmgBy4Vb42J
ABLwb+Kt+y2Dk15tggVcAHP2Khri+lRXWvda+kZAe2F1IojmuWyCTy3FEYHic5qN
BsXcf6u1oyFV8MybOuz1zGj3vd2C+dEK... | 4,066 | 67 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_datetime.py | import unittest
import sys
from test.support import import_fresh_module, run_unittest
if __name__ == "PYOBJ.COM":
import _datetime
import _strptime
import datetime
from test import datetimetester
TESTS = 'test.datetimetester'
try:
pure_tests = import_fresh_module(TESTS, fresh=['datetime', '_strp... | 2,396 | 66 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_thread.py | import os
import unittest
import random
from test import support
thread = support.import_module('_thread')
import time
import sys
import weakref
from test import lock_tests
NUMTASKS = 10
NUMTRIPS = 3
POLL_SLEEP = 0.010 # seconds = 10 ms
_print_mutex = thread.allocate_lock()
def verbose_print(arg):
"""Helper fun... | 8,638 | 271 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/tf_inherit_check.py | # Helper script for test_tempfile.py. argv[2] is the number of a file
# descriptor which should _not_ be open. Check this by attempting to
# write to it -- if we succeed, something is wrong.
import sys
import os
from test.support import SuppressCrashReport
with SuppressCrashReport():
verbose = (sys.argv[1] == '... | 714 | 28 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_int.py | import sys
import unittest
from test import support
from test.test_grammar import (VALID_UNDERSCORE_LITERALS,
INVALID_UNDERSCORE_LITERALS)
L = [
('0', 0),
('1', 1),
('9', 9),
('10', 10),
('99', 99),
('100', 100),
('314', 314),
... | 19,674 | 519 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/profilee.py | """
Input for test_profile.py and test_cprofile.py.
IMPORTANT: This stuff is touchy. If you modify anything above the
test class you'll have to regenerate the stats by running the two
test files.
*ALL* NUMBERS in the expected output are relevant. If you change
the formatting of pstats, please don't just regenerate t... | 3,041 | 116 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/tokenize_tests-utf8-coding-cookie-and-utf8-bom-sig.txt | # -*- coding: utf-8 -*-
# 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!
# Arbitrary encoded utf-8 text (stolen from test_doctest2.py).
x = 'ÐÐÐÐÐ'
def y():
"""
And again in a comment. ÐÐÐÐÐ
"""
... | 327 | 13 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/mod_generics_cache.py | """Module for testing the behavior of generics across different modules."""
import sys
from textwrap import dedent
from typing import TypeVar, Generic, Optional
if sys.version_info[:2] >= (3, 6):
exec(dedent("""
default_a: Optional['A'] = None
default_b: Optional['B'] = None
T = TypeVar('T')
c... | 1,160 | 54 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/formatfloat_testcases.txt | -- 'f' code formatting, with explicit precision (>= 0). Output always
-- has the given number of places after the point; zeros are added if
-- necessary to make this true.
-- zeros
%.0f 0 -> 0
%.1f 0 -> 0.0
%.2f 0 -> 0.00
%.3f 0 -> 0.000
%.50f 0 -> 0.00000000000000000000000000000000000000000000000000
-- precision 0... | 7,630 | 356 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_pow.py | import unittest
class PowTest(unittest.TestCase):
def powtest(self, type):
if type != float:
for i in range(-1000, 1000):
self.assertEqual(pow(type(i), 0), 1)
self.assertEqual(pow(type(i), 1), type(i))
self.assertEqual(pow(type(0), 1), type(0))
... | 4,471 | 124 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/gdb_sample.py | # Sample script for use by test_gdb.py
def foo(a, b, c):
bar(a, b, c)
def bar(a, b, c):
baz(a, b, c)
def baz(*args):
id(42)
foo(1, 2, 3)
| 153 | 13 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_future3.py | from __future__ import nested_scopes
from __future__ import division
import unittest
x = 2
def nester():
x = 3
def inner():
return x
return inner()
class TestFuture(unittest.TestCase):
def test_floor_div_operator(self):
self.assertEqual(7 // 2, 3)
def test_true_div_as_default(s... | 490 | 27 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_distutils.py | """Tests for distutils.
The tests for distutils are defined in the distutils.tests package;
the test_suite() function there returns a test suite that's ready to
be run.
"""
import distutils.tests
import test.support
def test_main():
test.support.run_unittest(distutils.tests.test_suite())
test.support.reap_c... | 375 | 19 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/randv3.pck | crandom
Random
p0
(tRp1
(I3
(L2147483648L
L994081831L
L2806287265L
L2228999830L
L3396498069L
L2956805457L
L3273927761L
L920726507L
L1862624492L
L2921292485L
L1779526843L
L2469105503L
L251696293L
L1254390717L
L779197080L
L3165356830L
L2007365218L
L1870028812L
L2896519363L
L1855578438L
L979518416L
L3481710246L
L319186150... | 8,004 | 633 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_random.py | import unittest
import unittest.mock
import random
import time
import pickle
import warnings
from functools import partial
from math import log, exp, pi, fsum, sin
from test import support
from fractions import Fraction
class TestBasicOps:
# Superclass with tests common to all generators.
# Subclasses must arr... | 41,043 | 951 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_normalization.py | from test.support import open_urlresource
import unittest
from http.client import HTTPException
import sys
from unicodedata import normalize, unidata_version
TESTDATAFILE = "NormalizationTest.txt"
TESTDATAURL = "http://www.pythontest.net/unicode/" + unidata_version + "/" + TESTDATAFILE
def check_version(testfile):
... | 3,403 | 109 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/CP936.TXT | #
# Name: cp936 to Unicode table
# Unicode version: 2.0
# Table version: 2.01
# Table format: Format A
# Date: 1/7/2000
#
# Contact: Shawn.Steele@microsoft.com
#
# General notes: none
#
# Format: Three tab-separated columns
# Column #1 is the cp936 code (in hex)
# ... | 219,799 | 22,066 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_difflib_expect.html |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
table.diff {font-family:Courier... | 103,266 | 526 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/pystone.py | #! /usr/bin/env python3
"""
"PYSTONE" Benchmark Program
Version: Python/1.2 (corresponds to C/1.1 plus 3 Pystone fixes)
Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
Translated from ADA to C by Rick Richardson.
Every method to preserve ADA-likeness ... | 7,731 | 278 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_urllib_response.py | """Unit tests for code in urllib.response."""
import socket
import tempfile
import urllib.response
import unittest
class TestResponse(unittest.TestCase):
def setUp(self):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.fp = self.sock.makefile('rb')
self.test_headers = {... | 1,728 | 60 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_wave.py | import unittest
from test import audiotests
from test import support
from audioop import byteswap
import sys
import wave
class WaveTest(audiotests.AudioWriteTests,
audiotests.AudioTestsWithSourceFile):
module = wave
class WavePCM8Test(WaveTest, unittest.TestCase):
sndfilename = 'pluck-pcm8.wa... | 4,186 | 114 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_zlib.py | import unittest
from test import support
import binascii
import pickle
import random
import sys
import cosmo
import zlib
from test.support import bigmemtest, _1G, _4G
requires_Compress_copy = unittest.skipUnless(
hasattr(zlib.compressobj(), "copy"),
'requires Compress.copy()')
requires_Decompress_copy ... | 34,959 | 919 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_largefile.py | """Test largefile support on system where this makes sense.
"""
import os
import stat
import sys
import unittest
from test.support import TESTFN, requires, unlink, bigmemtest
import io # C implementation of io
import _pyio as pyio # Python implementation of io
# size of file to create (>2 GiB; 2 GiB == 2,147,483,648... | 6,993 | 190 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_wait4.py | """This test checks for correct wait4() behavior.
"""
import os
import time
import sys
import unittest
from test.fork_wait import ForkWait
from test.support import reap_children, get_attribute
# If either of these do not exist, skip this test.
get_attribute(os, 'fork')
get_attribute(os, 'wait4')
class Wait4Test(For... | 1,182 | 40 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_grammar.py | # Python test set -- part 1, grammar.
# This just tests whether the parser accepts them all.
from test.support import check_syntax_error
import inspect
import unittest
import sys
# testing import *
from sys import *
# different import patterns to check that __annotations__ does not interfere
# with import machinery
i... | 47,972 | 1,491 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_sys.py | import unittest, test.support
from test.support.script_helper import assert_python_ok, assert_python_failure
import sys, io, os
import cosmo
import struct
import subprocess
import textwrap
import warnings
import operator
import codecs
import gc
import sysconfig
import platform
import locale
# count the number of test ... | 49,045 | 1,279 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_bisect.py | import sys
import unittest
from test import support
from collections import UserList
py_bisect = support.import_fresh_module('bisect', blocked=['_bisect'])
c_bisect = support.import_fresh_module('bisect', fresh=['_bisect'])
class Range(object):
"""A trivial range()-like object that has an insert() method."""
... | 14,252 | 333 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_base64.py | import unittest
from test import support
import base64
import binascii
import os
from array import array
from test.support import script_helper
class LegacyBase64TestCase(unittest.TestCase):
# Legacy API is not as permissive as the modern API
def check_type_errors(self, f):
self.assertRaises(TypeErro... | 29,650 | 657 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_sundry.py | """Do a minimal test of all the modules that aren't otherwise tested."""
import importlib
import sys
from test import support
import unittest
class TestUntestedModules(unittest.TestCase):
def test_untested_modules_can_be_imported(self):
untested = ('encodings', 'formatter', 'nturl2path', 'tabnanny')
... | 2,101 | 57 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_defaultdict.py | """Unit tests for collections.defaultdict."""
import os
import copy
import pickle
import tempfile
import unittest
from collections import defaultdict
def foobar():
return list
class TestDefaultDict(unittest.TestCase):
def test_basic(self):
d1 = defaultdict()
self.assertEqual(d1.default_fact... | 6,033 | 188 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_aifc.py | from test.support import check_no_resource_warning, findfile, TESTFN, unlink
import unittest
from unittest import mock
from test import audiotests
from audioop import byteswap
import io
import sys
import struct
import aifc
class AifcTest(audiotests.AudioWriteTests,
audiotests.AudioTestsWithSourceFile):... | 16,770 | 408 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_codecmaps_kr.py | #
# test_codecmaps_kr.py
# Codec mapping tests for ROK encodings
#
from test import multibytecodec_support
import unittest
class TestCP949Map(multibytecodec_support.TestBase_Mapping,
unittest.TestCase):
encoding = 'cp949'
mapfileurl = '/zip/.python/test/CP949.TXT'
class TestEUCKRMap(mult... | 1,143 | 36 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_sys_settrace.py | # Testing the line trace facility.
from test import support
import unittest
import sys
import difflib
import gc
from functools import wraps
class tracecontext:
"""Context manager that traces its enter and exit."""
def __init__(self, output, value):
self.output = output
self.value = value
... | 39,735 | 1,298 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test___all__.py | import unittest
from test import support
import os
import sys
class NoAll(RuntimeError):
pass
class FailedImport(RuntimeError):
pass
class AllTest(unittest.TestCase):
def check_all(self, modname):
names = {}
with support.check_warnings(
(".* (module|package)", DeprecationWa... | 3,900 | 110 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/final_a.py | """
Fodder for module finalization tests in test_module.
"""
import shutil
import test.final_b
x = 'a'
class C:
def __del__(self):
# Inspect module globals and builtins
print("x =", x)
print("final_b.x =", test.final_b.x)
print("shutil.rmtree =", getattr(shutil.rmtree, '__name__',... | 411 | 20 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_pwd.py | import sys
import unittest
from test import support
pwd = support.import_module('pwd')
def _getpwall():
# Android does not have getpwall.
if hasattr(pwd, 'getpwall'):
return pwd.getpwall()
elif hasattr(pwd, 'getpwuid'):
return [pwd.getpwuid(0)]
else:
return []
class PwdTest(un... | 4,642 | 126 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/ffdh3072.pem | DH Parameters: (3072 bit)
prime:
00:ff:ff:ff:ff:ff:ff:ff:ff:ad:f8:54:58:a2:bb:
4a:9a:af:dc:56:20:27:3d:3c:f1:d8:b9:c5:83:ce:
2d:36:95:a9:e1:36:41:14:64:33:fb:cc:93:9d:ce:
24:9b:3e:f9:7d:2f:e3:63:63:0c:75:d8:f6:81:b2:
02:ae:c4:61:7a:d3:df:1e:d5:d5:f... | 2,212 | 42 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_winconsoleio.py | '''Tests for WindowsConsoleIO
'''
import io
import os
import sys
import tempfile
import unittest
from test import support
if sys.platform != 'win32':
raise unittest.SkipTest("test only relevant on win32")
from _testconsole import write_input
ConIO = io._WindowsConsoleIO
class WindowsConsoleIOTests(unittest.Tes... | 6,293 | 196 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_dict.py | import cosmo
import collections
import collections.abc
import gc
import pickle
import random
import string
import sys
import unittest
import weakref
from test import support
class DictTest(unittest.TestCase):
def test_invalid_keyword_arguments(self):
class Custom(dict):
pass
for inval... | 41,056 | 1,308 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/autotest.py | # This should be equivalent to running regrtest.py from the cmdline.
# It can be especially handy if you're in an interactive shell, e.g.,
# from test import autotest.
from test.libregrtest import main
main()
| 209 | 6 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_source_encoding.py | # -*- coding: koi8-r -*-
import unittest
from test.support import TESTFN, unlink, unload, rmtree, script_helper, captured_stdout
import importlib
import os
import sys
import subprocess
import tempfile
from encodings import cp1252
class MiscSourceEncodingTest(unittest.TestCase):
def test_pep263(self):
sel... | 8,098 | 227 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/CP950.TXT | #
# Name: cp950 to Unicode table
# Unicode version: 2.0
# Table version: 2.01
# Table format: Format A
# Date: 1/7/2000
#
# Contact: Shawn.Steele@microsoft.com
#
# General notes: none
#
# Format: Three tab-separated columns
# Column #1 is the cp950 code (in hex)
# ... | 136,914 | 13,778 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_ioctl.py | import array
import unittest
from test.support import import_module, get_attribute
import os, struct
fcntl = import_module('fcntl')
termios = import_module('termios')
get_attribute(termios, 'TIOCGPGRP') #Can't run tests without this feature
if __name__ == 'PYOBJ.COM':
import fcntl
import termios
try:
tty... | 3,453 | 99 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/make_ssl_certs.py | """Make the custom certificate and private key files used by test_ssl
and friends."""
import os
import pprint
import shutil
import tempfile
from subprocess import *
req_template = """
[ default ]
base_url = http://testca.pythontest.net/testca
[req]
distinguished_name = req_distingui... | 8,722 | 283 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/nokia.pem | # Certificate for projects.developer.nokia.com:443 (see issue 13034)
-----BEGIN CERTIFICATE-----
MIIFLDCCBBSgAwIBAgIQLubqdkCgdc7lAF9NfHlUmjANBgkqhkiG9w0BAQUFADCB
vDELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL
ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTswOQYDVQQLEzJUZXJtcyBvZiB1c2Ug
YXQgaHR0cHM6Ly93d3cudmVyaXNp... | 1,923 | 32 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_popen.py | """Basic tests for os.popen()
Particularly useful for platforms that fake popen.
"""
import unittest
from test import support
import os, sys
# Test that command-lines get down as we expect.
# To do this we execute:
# python -c "import sys;print(sys.argv)" {rest_of_commandline}
# This results in Python being spa... | 2,025 | 66 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/doctest_aliases.py | # Used by test_doctest.py.
class TwoNames:
'''f() and g() are two names for the same method'''
def f(self):
'''
>>> print(TwoNames().f())
f
'''
return 'f'
g = f # define an alias for f
| 240 | 14 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/mock_socket.py | """Mock socket module used by the smtpd and smtplib tests.
"""
# imported for _GLOBAL_DEFAULT_TIMEOUT
import socket as socket_module
# Mock socket module
_defaulttimeout = None
_reply_data = None
# This is used to queue up data to be read through socket.makefile, typically
# *before* the socket object is even create... | 3,611 | 160 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_regrtest.py | """
Tests of regrtest.py.
Note: test_regrtest cannot be run twice in parallel.
"""
import contextlib
import faulthandler
import io
import os.path
import platform
import re
import subprocess
import sys
import sysconfig
import tempfile
import textwrap
import unittest
from test import libregrtest
from test import suppor... | 40,414 | 1,091 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_wsgiref.py | import cosmo
from unittest import mock
from test import support
from test.test_httpservers import NoLogRequestHandler
from unittest import TestCase
from wsgiref.util import setup_testing_defaults
from wsgiref.headers import Headers
from wsgiref.handlers import BaseHandler, BaseCGIHandler, SimpleHandler
from wsgiref imp... | 27,879 | 788 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_ast.py | import ast
import dis
import os
import sys
import unittest
import weakref
from test import support
def to_tuple(t):
if t is None or isinstance(t, (str, int, complex)):
return t
elif isinstance(t, list):
return [to_tuple(e) for e in t]
result = [t.__class__.__name__]
if hasattr(t, 'line... | 50,121 | 1,171 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_abstract_numbers.py | """Unit tests for numbers.py."""
import math
import operator
import unittest
from numbers import Complex, Real, Rational, Integral
class TestNumbers(unittest.TestCase):
def test_int(self):
self.assertTrue(issubclass(int, Integral))
self.assertTrue(issubclass(int, Complex))
self.assertEqua... | 1,528 | 45 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_dis.py | # Minimal tests for dis module
from test.support import captured_stdout
from test.bytecode_helper import BytecodeTestCase
import difflib
import unittest
import sys
import cosmo
import dis
import io
import re
import types
import contextlib
def get_tb():
def _error():
try:
1 / 0
except E... | 44,846 | 970 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/keycert.passwd.pem | -----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,D134E931C96D9DEC
nuGFEej7vIjkYWSMz5OJeVTNntDRQi6ZM4DBm3g8T7i/0odr3WFqGMMKZcIhLYQf
rgRq7RSKtrJ1y5taVucMV+EuCjyfzDo0TsYt+ZrXv/D08eZhjRmkhoHnGVF0TqQm
nQEXM/ERT4J2RM78dnG+homMkI76qOqxgGbRqQqJo6AiVRcAZ45y8s96bru2TAB8
+pWjO/v0Je7AFVdwSU52N8OOY6uoS... | 4,101 | 69 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_htmlparser.py | """Tests for HTMLParser.py."""
import html.parser
import pprint
import unittest
class EventCollector(html.parser.HTMLParser):
def __init__(self, *args, **kw):
self.events = []
self.append = self.events.append
html.parser.HTMLParser.__init__(self, *args, **kw)
def get_events(self):
... | 32,698 | 779 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_mailbox.py | import os
import sys
import time
import stat
import socket
import email
import email.message
import re
import io
import tempfile
from test import support
import unittest
import textwrap
import mailbox
import glob
class TestBase:
all_mailbox_types = (mailbox.Message, mailbox.MaildirMessage,
... | 92,820 | 2,289 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/keycert.pem | -----BEGIN PRIVATE KEY-----
MIIG/wIBADANBgkqhkiG9w0BAQEFAASCBukwggblAgEAAoIBgQCylKlLaKU+hOvJ
DfriTRLd+IthG5hv28I3A/CGjLICT0rDDtgaXd0uqloJAnjsgn5gMAcStpDW8Rm+
t6LsrBL+5fBgkyU1r94Rvx0HHoyaZwBBouitVHw28hP3W+smddkqB1UxpGnTeL2B
gj3dVo/WTtRfO+0h0PKw1l98YE1pMTdqIwcOOE/ER0g4hvA/wrxuLhMvlVLMy/lL
58uctqaDUqryNyeerKbVkq4fJyCG5D2T... | 4,058 | 67 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_dummy_thread.py | import _dummy_thread as _thread
import time
import queue
import random
import unittest
from test import support
from unittest import mock
DELAY = 0
class LockTests(unittest.TestCase):
"""Test lock objects."""
def setUp(self):
# Create a lock
self.lock = _thread.allocate_lock()
def test_... | 9,376 | 257 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_os.py | # As a test suite for the os module, this is woefully inadequate, but this
# does add tests for a few functions which have been determined to be more
# portable than they had been thought to be.
import asynchat
import asyncore
import codecs
import contextlib
import decimal
import errno
import fractions
import getpass
... | 121,219 | 3,290 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_strftime.py | """
Unittest for time.strftime
"""
import calendar
import sys
import re
from test import support
import time
import unittest
# helper functions
def fixasctime(s):
if s[8] == ' ':
s = s[:8] + '0' + s[9:]
return s
def escapestr(text, ampm):
"""
Escape text to deal with possible locale values t... | 7,800 | 208 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_frame.py | import gc
import sys
import types
import unittest
import weakref
from test import support
class ClearTest(unittest.TestCase):
"""
Tests for frame.clear().
"""
def inner(self, x=5, **kwargs):
1/0
def outer(self, **kwargs):
try:
self.inner(**kwargs)
except Zero... | 4,476 | 166 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/floating_points.txt | # These numbers are used to test floating point binary-to-decimal conversion.
# They are based on the TCL test suite (tests/expr.test), which is based on
# test data from:
# Brigitte Verdonk, Annie Cuyt, Dennis Verschaeren, A precision and range
# independent tool for testing floating-point arithmetic II: Conversions,
... | 16,302 | 1,029 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_future.py | # Test various flavors of legal and illegal future statements
import unittest
from test import support
import os
import re
rx = re.compile(r'\((\S+).py, line (\d+)')
def get_error_location(msg):
mo = rx.search(str(msg))
return mo.group(1, 2)
class FutureTest(unittest.TestCase):
def check_syntax_error(s... | 3,894 | 109 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_faulthandler.py | from contextlib import contextmanager
import datetime
import faulthandler
import os
import re
import signal
import subprocess
import sys
import cosmo
from test import support
from test.support import script_helper, is_android, requires_android_level
import tempfile
import unittest
from textwrap import dedent
try:
... | 29,204 | 834 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_unpack_ex.py | # Tests for extended unpacking, starred expressions.
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 = l
>>> a == 4 and b == [5, 6]
True
Unpack implied tuple
>>> *a, = 7, 8, 9
>>... | 8,932 | 366 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_concurrent_futures.py | import test.support
# Skip tests if _multiprocessing wasn't built.
test.support.import_module('_multiprocessing')
# Skip tests if sem_open implementation is broken.
test.support.import_module('multiprocessing.synchronize')
# import threading after _multiprocessing to raise a more relevant error
# message: "No module n... | 29,066 | 837 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_sqlite.py | import test.support
# Skip test if _sqlite3 module not installed
test.support.import_module('_sqlite3')
import unittest
import sqlite3
from sqlite3.test import (dbapi, types, userfunctions,
factory, transactions, hooks, regression,
dump)
def load_tests(... | 893 | 25 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/__init__.py | # Dummy file to make this directory a package.
| 47 | 2 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_getargs2.py | import unittest
import math
import string
import sys
from test import support
# Skip this test if the _testcapi module isn't available.
_testcapi = support.import_module('_testcapi')
from _testcapi import getargs_keywords, getargs_keyword_only
# > How about the following counterproposal. This also changes some of
# > ... | 46,503 | 1,137 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_generators.py | import copy
import gc
import pickle
import sys
import unittest
import warnings
import weakref
import inspect
import types
from test import support
try:
import _testcapi
except ImportError:
_testcapi = None
# This tests to make sure that if a SIGINT arrives just before we send into a
# yield from chain, the ... | 60,731 | 2,240 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/badsyntax_future10.py | from __future__ import absolute_import
"spam, bar, blah"
from __future__ import print_function
| 95 | 4 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_asyncgen.py | import inspect
import sys
import types
import unittest
from unittest import mock
from test.support import import_module
asyncio = import_module("asyncio")
class AwaitException(Exception):
pass
@types.coroutine
def awaitable(*, throw=False):
if throw:
yield ('throw',)
else:
yield ('resu... | 30,024 | 1,101 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_runpy.py | # Test the runpy module
import unittest
import os
import os.path
import sys
import cosmo
import re
import tempfile
import importlib, importlib.machinery, importlib.util
import py_compile
import warnings
from test.support import (
forget, make_legacy_pyc, unload, verbose, no_tracing,
create_empty_file, temp_dir)... | 31,805 | 751 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_xdrlib.py | import unittest
import xdrlib
class XDRTest(unittest.TestCase):
def test_xdr(self):
p = xdrlib.Packer()
s = b'hello world'
a = [b'what', b'is', b'hapnin', b'doctor']
p.pack_int(42)
p.pack_int(-17)
p.pack_uint(9)
p.pack_bool(True)
p.pack_bool(False... | 2,226 | 78 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/sample_doctest_no_doctests.py | """This is a sample module used for testing doctest.
This module is for testing how doctest handles a module with docstrings
but no doctest examples.
"""
class Foo(object):
"""A docstring with no doctest examples.
"""
def __init__(self):
pass
| 269 | 16 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_doctest.txt | This is a sample doctest in a text file.
In this example, we'll rely on a global variable being set for us
already:
>>> favorite_color
'blue'
We can make this fail by disabling the blank-line feature.
>>> if 1:
... print('a')
... print()
... print('b')
a
<BLANKLINE>
b
| 300 | 18 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_tarfile.py | import sys
import os
import io
from hashlib import md5
from contextlib import contextmanager
from random import Random
import pathlib
import unittest
import unittest.mock
import tarfile
from test import support
from test.support import script_helper
# Check for our compression modules.
try:
import gzip
except Im... | 99,168 | 2,655 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_turtle.py | import pickle
import unittest
from test import support
turtle = support.import_module('turtle')
Vec2D = turtle.Vec2D
test_config = """\
width = 0.75
height = 0.8
canvwidth = 500
canvheight = 200
leftright = 100
topbottom = 100
mode = world
colormode = 255
delay = 100
undobuffersize = 10000
shape = circle
pencolor = ... | 12,657 | 437 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/cfgparser.1 | # Also used by idlelib.test_idle.test_config.
[Foo Bar]
foo=newbar
| 67 | 4 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_unicode_identifiers.py | import unittest
import sys
class PEP3131Test(unittest.TestCase):
def test_valid(self):
class T:
ä = 1
µ = 2 # this is a compatibility character
è = 3
xó = 4
self.assertEqual(getattr(T, "\xe4"), 1)
self.assertEqual(getattr(T, "\u03bc"),... | 961 | 34 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_gdb.py | # Verify that gdb can pretty-print the various PyObject* types
#
# The code for testing gdb was adapted from similar work in Unladen Swallow's
# Lib/test/test_jit_gdb.py
import locale
import os
import platform
import re
import subprocess
import sys
import sysconfig
import textwrap
import unittest
# Is this Python con... | 40,792 | 982 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/badsyntax_future4.py | """This is a test"""
import __future__
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
| 153 | 11 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_repl.py | """Test the interactive interpreter."""
import sys
import cosmo
import os
import unittest
import subprocess
from textwrap import dedent
from test.support import cpython_only, SuppressCrashReport
from test.support.script_helper import kill_python
if __name__ == "PYOBJ.COM":
import _testcapi
def spawn_repl(*args, ... | 2,395 | 68 | jart/cosmopolitan | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.