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_module.py | # Test the module type
import cosmo
import unittest
import weakref
from test.support import gc_collect, requires_type_collecting
from test.support.script_helper import assert_python_ok
import sys
ModuleType = type(sys)
class FullLoader:
@classmethod
def module_repr(cls, m):
return "<module '{}' (craft... | 8,769 | 248 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/ssl_key.passwd.pem | -----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,8064BE1494B24B13
KJrffOMbo8M0I3PzcYxRZGMpKD1yB3Ii4+bT5XoanxjIJ+4fdx6LfZ0Rsx+riyzs
tymsQu/iYY9j+4rCvN9+eetsL1X6iZpiimKsLexcid9M3fb0vxED5Sgw0dvunCUA
xhqjLIKR92MKbODHf6KrDKCpsiPbjq4gZ7P+uCGXAMHL3MXIJSC0hW9rK7Ce6oyO
CjpIcgB8x+GUWZZZhAFdlzIHMZrte... | 2,531 | 43 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_sysconfig.py | import unittest
import sys
import os
import subprocess
import shutil
from copy import copy
from test.support import (run_unittest,
import_module, TESTFN, unlink, check_warnings,
captured_stdout, skip_unless_symlink, change_cwd)
import sysconfig
from sysconfig import... | 18,880 | 459 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_tcl.py | import unittest
import re
import subprocess
import sys
import os
from test import support
# Skip this test if the _tkinter module wasn't built.
_tkinter = support.import_module('_tkinter')
import tkinter
from tkinter import Tcl
from _tkinter import TclError
try:
from _testcapi import INT_MAX, PY_SSIZE_T_MAX
exce... | 29,633 | 753 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/randv2_32.pck | crandom
Random
p0
(tRp1
(I2
(I-2147483648
I-845974985
I-1294090086
I1193659239
I-1849481736
I-946579732
I-34406770
I1749049471
I1997774682
I1432026457
I1288127073
I-943175655
I-1718073964
I339993548
I-1045260575
I582505037
I-1555108250
I-1114765620
I1578648750
I-350384412
I-20845848
I-288255314
I738790953
I1901249641
I... | 7,517 | 633 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_audioop.py | import audioop
import sys
import unittest
def pack(width, data):
return b''.join(v.to_bytes(width, sys.byteorder, signed=True) for v in data)
def unpack(width, data):
return [int.from_bytes(data[i: i + width], sys.byteorder, signed=True)
for i in range(0, len(data), width)]
packs = {w: (lambda *d... | 28,977 | 567 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/EUC-JP.TXT | 00 0000
01 0001
02 0002
03 0003
04 0004
05 0005
06 0006
07 0007
08 0008
09 0009
0A 000A
0B 000B
0C 000C
0D 000D
0E 000E
0F 000F
10 0010
11 0011
12 0012
13 0013
14 0014
15 0015
16 0016
17 0017
18 0018
19 0019
1A 001A
1B 001B
1C 001C
1D 001D
1E 001E
1F 001F
20 0020
21 0021
22 0022
23 0023
24 0024
25 0025
26 0026
27 0027
... | 143,236 | 13,137 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_typechecks.py | """Unit tests for __instancecheck__ and __subclasscheck__."""
import unittest
class ABC(type):
def __instancecheck__(cls, inst):
"""Implement isinstance(inst, cls)."""
return any(cls.__subclasscheck__(c)
for c in {type(inst), inst.__class__})
def __subclasscheck__(cls, su... | 2,615 | 72 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_smtpd.py | import unittest
import textwrap
from test import support, mock_socket
import socket
import io
import smtpd
import asyncore
class DummyServer(smtpd.SMTPServer):
def __init__(self, *args, **kwargs):
smtpd.SMTPServer.__init__(self, *args, **kwargs)
self.messages = []
if self._decode_data:
... | 41,104 | 1,014 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_syntax.py | """This module tests SyntaxErrors.
Here's an example of the sort of thing that is tested.
>>> def f(x):
... global x
Traceback (most recent call last):
SyntaxError: name 'x' is parameter and global
The tests are all raise SyntaxErrors. They were created by checking
each C call that raises SyntaxError. There ar... | 20,456 | 643 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_threaded_import.py | # This is a variant of the very old (early 90's) file
# Demo/threads/bug.py. It simply provokes a number of threads into
# trying to import the same module "at the same time".
# There are no pleasant failure modes -- most likely is that Python
# complains several times about module random having no attribute
# randran... | 8,782 | 255 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/lock_tests.py | """
Various tests for synchronization primitives.
"""
import sys
import time
from _thread import start_new_thread, TIMEOUT_MAX
import threading
import unittest
import weakref
from test import support
def _wait():
# A crude wait/yield function not relying on synchronization primitives.
time.sleep(0.01)
clas... | 28,878 | 950 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_baseexception.py | import unittest
import builtins
import os
from platform import system as platform_system
class ExceptionClassTests(unittest.TestCase):
"""Tests for anything relating to exception objects themselves (e.g.,
inheritance hierarchy)"""
def test_builtins_new_style(self):
self.assertTrue(issubclass(Exc... | 7,028 | 184 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/badsyntax_future3.py | """This is a test"""
from __future__ import nested_scopes
from __future__ import rested_snopes
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
| 172 | 11 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_userlist.py | # Check every path through every method of UserList
from collections import UserList
from test import list_tests
import unittest
class UserListTest(list_tests.CommonTest):
type2test = UserList
def test_getslice(self):
super().test_getslice()
l = [0, 1, 2, 3, 4]
u = self.type2test(l)
... | 1,850 | 64 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_ossaudiodev.py | from test import support
support.requires('audio')
from test.support import findfile
ossaudiodev = support.import_module('ossaudiodev')
import errno
import sys
import sunau
import time
import audioop
import unittest
# Arggh, AFMT_S16_NE not defined on all platforms -- seems to be a
# fairly recent addition to OSS.
... | 7,216 | 203 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_charmapcodec.py | """ Python character mapping codec test
This uses the test codec in testcodec.py and thus also tests the
encodings package lookup scheme.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright 2000 Guido van Rossum.
"""#"
import unittest
import codecs
# Register a search function which knows about our co... | 1,718 | 54 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_glob.py | import glob
import os
import shutil
import sys
import unittest
from test.support import (TESTFN, skip_unless_symlink,
can_symlink, create_empty_file, change_cwd)
class GlobTests(unittest.TestCase):
def norm(self, *parts):
return os.path.normpath(os.path.join(self.tempdir, *part... | 12,688 | 318 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_minidom.py | # test for xml.dom.minidom
import copy
import pickle
from test import support
import unittest
import xml.dom.minidom
from xml.dom.minidom import parse, Node, Document, parseString
from xml.dom.minidom import getDOMImplementation
tstfile = support.findfile("test.xml", subdir="xmltestdata")
sample = ("<?xml version=... | 67,356 | 1,627 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_finalization.py | """
Tests for object finalization semantics, as outlined in PEP 442.
"""
import contextlib
import gc
import unittest
import weakref
try:
from _testcapi import with_tp_del
except ImportError:
def with_tp_del(cls):
class C(object):
def __new__(cls, *args, **kwargs):
raise Typ... | 14,502 | 520 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_collections.py | """Unit tests for collections.py."""
import collections
import copy
import doctest
import inspect
import keyword
import operator
import pickle
from random import choice, randrange
import re
import string
import sys
from test import support
import types
import unittest
from collections import namedtuple, Counter, Orde... | 75,906 | 1,927 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_dbm_ndbm.py | from test import support
support.import_module("dbm.ndbm") #skip if not supported
import os
import unittest
import dbm.ndbm
from dbm.ndbm import error
class DbmTestCase(unittest.TestCase):
def setUp(self):
self.filename = support.TESTFN
self.d = dbm.ndbm.open(self.filename, 'c')
self.d.clo... | 4,409 | 112 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_numeric_tower.py | # test interactions between int, float, Decimal and Fraction
import unittest
import random
import math
import sys
import operator
from decimal import Decimal as D
from fractions import Fraction as F
# Constants related to the hash implementation; hash(x) is based
# on the reduction of x modulo the prime _PyHASH_MOD... | 7,352 | 203 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_multiprocessing_spawn.py | import unittest
import test._test_multiprocessing
from test import support
if support.PGO:
raise unittest.SkipTest("test is not helpful for PGO")
test._test_multiprocessing.install_tests_in_module_dict(globals(), 'spawn')
if __name__ == '__main__':
unittest.main()
| 277 | 13 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_nis.py | from test import support
import unittest
# Skip test if nis module does not exist.
nis = support.import_module('nis')
class NisTests(unittest.TestCase):
def test_maps(self):
try:
maps = nis.maps()
except nis.error as msg:
# NIS is probably not active, so this test isn't us... | 1,156 | 40 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_operator.py | import unittest
import pickle
import sys
from test import support
py_operator = support.import_fresh_module('operator', blocked=['_operator'])
c_operator = support.import_fresh_module('operator', fresh=['_operator'])
class Seq1:
def __init__(self, lst):
self.lst = lst
def __len__(self):
retur... | 23,365 | 611 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_binhex.py | """Test script for the binhex C module
Uses the mechanism of the python binhex module
Based on an original test by Roger E. Masse.
"""
import sys
import binhex
import unittest
from test import support
class BinHexTestCase(unittest.TestCase):
def setUp(self):
self.fname1 = support.TESTFN + "1"
... | 1,509 | 57 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_genericpath.py | """
Tests common to genericpath, macpath, ntpath and posixpath
"""
import genericpath
import os
import sys
import unittest
import warnings
from test import support
from test.support.script_helper import assert_python_ok
from test.support import FakePath
def create_file(filename, data=b'foo'):
with open(filename,... | 21,101 | 555 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_poplib.py | """Test script for poplib module."""
# Modified by Giampaolo Rodola' to give poplib.POP3 and poplib.POP3_SSL
# a real test suite
import poplib
import asyncore
import asynchat
import socket
import os
import errno
from unittest import TestCase, skipUnless
from test import support as test_support
threading = test_suppo... | 16,978 | 535 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_timeit.py | import cosmo
import timeit
import unittest
import sys
import io
import time
from textwrap import dedent
from test.support import captured_stdout
from test.support import captured_stderr
# timeit's default number of iterations.
DEFAULT_NUMBER = 1000000
# timeit's default number of repetitions.
DEFAULT_REPEAT = 3
# X... | 14,884 | 385 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_augassign.py | # Augmented assignment test.
import unittest
class AugAssignTest(unittest.TestCase):
def testBasic(self):
x = 2
x += 1
x *= 2
x **= 2
x -= 8
x //= 5
x %= 3
x &= 2
x |= 5
x ^= 1
x /= 2
self.assertEqual(x, 3.0)
def... | 7,868 | 327 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_array.py | """Test the arraymodule.
Roger E. Masse
"""
import unittest
from test import support
import weakref
import pickle
import operator
import struct
import sys
import warnings
import array
from array import _array_reconstructor as array_reconstructor
sizeof_wchar = array.array('u').itemsize
class ArraySubclass(array... | 48,152 | 1,390 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_lzma.py | import _compression
from io import BytesIO, UnsupportedOperation, DEFAULT_BUFFER_SIZE
import os
import pathlib
import pickle
import random
import sys
from test import support
import unittest
from encodings import utf_16_le
from test.support import (
_4G, TESTFN, import_module, bigmemtest, run_unittest, unlink
)
l... | 79,724 | 1,777 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_reprlib.py | """
Test cases for the repr module
Nick Mathewson
"""
import sys
import os
import shutil
import importlib
import importlib.util
import unittest
from test.support import create_empty_file, verbose
from reprlib import repr as r # Don't shadow builtin repr
from reprlib import Repr
from reprlib import recursive_repr
... | 15,606 | 406 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_logging.py | # Copyright 2001-2017 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... | 158,641 | 4,526 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_tempfile.py | # tempfile.py unit tests.
import tempfile
import errno
import io
import os
import signal
import sys
import re
import warnings
import contextlib
import weakref
from unittest import mock
import unittest
from test import support
from encodings import utf_16
from test.support import script_helper
if hasattr(os, 'stat'):... | 51,703 | 1,464 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_symbol.py | import unittest
from test import support
import os
import sys
import subprocess
SYMBOL_FILE = support.findfile('symbol.py')
GRAMMAR_FILE = os.path.join(os.path.dirname(__file__),
'..', '..', 'Include', 'graminit.h')
TEST_PY_FILE = 'symbol_te... | 1,880 | 55 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_select.py | import errno
import os
import select
import cosmo
import sys
import unittest
from test import support
@unittest.skipIf((sys.platform[:3]=='win'),
"can't easily test on this system")
class SelectTestCase(unittest.TestCase):
class Nope:
pass
class Almost:
def fileno(self):
... | 2,882 | 87 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_structseq.py | import os
import time
import unittest
class StructSeqTest(unittest.TestCase):
def test_tuple(self):
t = time.gmtime()
self.assertIsInstance(t, tuple)
astuple = tuple(t)
self.assertEqual(len(t), len(astuple))
self.assertEqual(t, astuple)
# Check that slicing works ... | 3,964 | 127 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_hashlib.py | # Test hashlib module
#
# $Id$
#
# Copyright (C) 2005-2010 Gregory P. Smith (greg@krypto.org)
# Licensed to PSF under a Contributor Agreement.
#
import array
from binascii import unhexlify
import hashlib
import importlib
import itertools
import os
import sys
try:
import _thread
import threading
except Impo... | 24,471 | 635 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_modulefinder.py | import os
import errno
import importlib.machinery
import py_compile
import shutil
import unittest
import tempfile
from test import support
import modulefinder
TEST_DIR = tempfile.mkdtemp()
TEST_PATH = [TEST_DIR, os.path.dirname(tempfile.__file__)]
# Each test description is a list of 5 items:
#
# 1. a module name t... | 9,272 | 338 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/sample_doctest_no_docstrings.py | # This is a sample module used for testing doctest.
#
# This module is for testing how doctest handles a module with no
# docstrings.
class Foo(object):
# A class with no docstring.
def __init__(self):
pass
| 227 | 13 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_compare.py | import unittest
class Empty:
def __repr__(self):
return '<Empty>'
class Cmp:
def __init__(self,arg):
self.arg = arg
def __repr__(self):
return '<Cmp %s>' % self.arg
def __eq__(self, other):
return self.arg == other
class Anything:
def __eq__(self, other):
... | 3,914 | 125 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_tix.py | import unittest
from test import support
import sys
# Skip this test if the _tkinter module wasn't built.
_tkinter = support.import_module('_tkinter')
# Skip test if tk cannot be initialized.
support.requires('gui')
from tkinter import tix, TclError
class TestTix(unittest.TestCase):
def setUp(self):
t... | 756 | 33 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_cmd_line_script.py | # tests command line execution of scripts
import contextlib
import importlib
import importlib.machinery
import zipimport
import unittest
import sys
import os
import os.path
import py_compile
import subprocess
import io
import textwrap
from test import support
from test.support.script_helper import (
make_pkg, mak... | 29,572 | 660 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/ann_module.py |
"""
The module for testing variable annotations.
Empty lines above are for good reason (testing for correct line numbers)
"""
from typing import Optional
__annotations__[1] = 2
class C:
x = 5; y: Optional['C'] = None
from typing import Tuple
x: int = 5; y: str = x; f: Tuple[int, int]
class M(type):
__a... | 953 | 54 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_traceback.py | """Test cases for traceback module"""
from collections import namedtuple
from io import StringIO
import linecache
import sys
import cosmo
import unittest
import re
from test import support
from test.support import TESTFN, Error, captured_output, unlink, cpython_only
from test.support.script_helper import assert_python... | 45,651 | 1,180 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_contextlib.py | """Unit tests for contextlib.py, and other context managers."""
import io
import sys
import tempfile
import unittest
from contextlib import * # Tests __all__
from test import support
try:
import _thread
import threading
except ImportError:
threading = None
class TestAbstractContextManager(unittest.TestC... | 31,511 | 992 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_metaclass.py | doctests = """
Basic class construction.
>>> class C:
... def meth(self): print("Hello")
...
>>> C.__class__ is type
True
>>> a = C()
>>> a.__class__ is C
True
>>> a.meth()
Hello
>>>
Use *args notation for the bases.
>>> class A: pass
>>> class B: pass
>>>... | 6,350 | 266 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_bigmem.py | """Bigmem tests - tests for the 32-bit boundary in containers.
These tests try to exercise the 32-bit boundary that is sometimes, if
rarely, exceeded in practice, but almost never tested. They are really only
meaningful on 64-bit builds on machines with a *lot* of memory, but the
tests are always run, usually with ve... | 45,503 | 1,271 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_macpath.py | import macpath
from test import test_genericpath
import unittest
class MacPathTestCase(unittest.TestCase):
def test_abspath(self):
self.assertEqual(macpath.abspath("xx:yy"), "xx:yy")
def test_isabs(self):
isabs = macpath.isabs
self.assertTrue(isabs("xx:yy"))
self.assertTrue(i... | 6,172 | 150 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/signalinterproctester.py | import os
import signal
import subprocess
import sys
import time
import unittest
class SIGUSR1Exception(Exception):
pass
class InterProcessSignalTests(unittest.TestCase):
def setUp(self):
self.got_signals = {'SIGHUP': 0, 'SIGUSR1': 0, 'SIGALRM': 0}
def sighup_handler(self, signum, frame):
... | 2,761 | 84 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/ann_module3.py | """
Correct syntax for variable annotation that should fail at runtime
in a certain manner. More examples are in test_grammar and test_parser.
"""
def f_bad_ann():
__annotations__[1] = 2
class C_OK:
def __init__(self, x: int) -> None:
self.x: no_such_name = x # This one is OK as proposed by Guido
cl... | 448 | 19 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_memoryview.py | """Unit tests for the memoryview
Some tests are in test_bytes. Many tests that require _testbuffer.ndarray
are in test_buffer.
"""
import unittest
import test.support
import sys
import gc
import weakref
import array
import io
import copy
import pickle
class AbstractMemoryTests:
source_bytes = b"abcdef"
... | 17,856 | 538 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_dummy_threading.py | from test import support
import unittest
import dummy_threading as _threading
import time
class DummyThreadingTestCase(unittest.TestCase):
class TestThread(_threading.Thread):
def run(self):
global running
global sema
global mutex
# Uncomment if testing ano... | 1,743 | 61 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_py_compile.py | import importlib.util
import os
import py_compile
import shutil
import stat
import sys
import tempfile
import unittest
from test import support
class PyCompileTests(unittest.TestCase):
def setUp(self):
self.directory = tempfile.mkdtemp(dir=os.getcwd())
self.source_path = os.path.join(self.direct... | 5,171 | 128 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/future_test2.py | """This is a test"""
from __future__ import nested_scopes; import site
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
| 149 | 11 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_doctest3.txt |
Here we check that `__file__` is provided:
>>> type(__file__)
<class 'str'>
| 82 | 6 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_string_literals.py | r"""Test correct treatment of various string literals by the parser.
There are four types of string literals:
'abc' -- normal str
r'abc' -- raw str
b'xyz' -- normal bytes
br'xyz' | rb'xyz' -- raw bytes
The difference between normal and raw strings is of course that i... | 10,080 | 251 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_webbrowser.py | import webbrowser
import unittest
import subprocess
from unittest import mock
from test import support
URL = 'http://www.example.com'
CMD_NAME = 'test'
class PopenMock(mock.MagicMock):
def poll(self):
return 0
def wait(self, seconds=None):
return 0
class CommandTestMixin:
def _test(... | 6,329 | 218 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_list.py | import sys
from test import list_tests
import pickle
import unittest
class ListTest(list_tests.CommonTest):
type2test = list
def test_basic(self):
self.assertEqual(list([]), [])
l0_3 = [0, 1, 2, 3]
l0_3_bis = list(l0_3)
self.assertEqual(l0_3, l0_3_bis)
self.assertTrue(l... | 5,448 | 156 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_fstring.py | import ast
import types
import decimal
import unittest
a_global = 'global variable'
# You could argue that I'm too strict in looking for specific error
# values with assertRaisesRegex, but without it it's way too easy to
# make a syntax error in the test strings. Especially with all of the
# triple quotes, raw str... | 41,197 | 1,038 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_eintr.py | import os
import signal
import subprocess
import sys
import unittest
from test import support
from test.support import script_helper
@unittest.skipUnless(os.name == "posix", "only supported on Unix")
class EINTRTests(unittest.TestCase):
@unittest.skipUnless(hasattr(signal, "setitimer"), "requires setitimer()")
... | 1,354 | 38 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_subclassinit.py | import sys
import types
import unittest
class Test(unittest.TestCase):
def test_init_subclass(self):
class A:
initialized = False
def __init_subclass__(cls):
super().__init_subclass__()
cls.initialized = True
class B(A):
pass
... | 8,324 | 285 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_functools.py | import abc
import cosmo
import builtins
import collections
import copy
from itertools import permutations
import pickle
from random import choice
import sys
from test import support
import time
import unittest
from weakref import proxy
import contextlib
try:
import _thread
import threading
except ImportError:
... | 79,033 | 2,106 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_difflib.py | import difflib
from test.support import run_unittest, findfile
import unittest
import doctest
import sys
class TestWithAscii(unittest.TestCase):
def test_one_insert(self):
sm = difflib.SequenceMatcher(None, 'b' * 100, 'a' + 'b' * 100)
self.assertAlmostEqual(sm.ratio(), 0.995, places=3)
sel... | 19,841 | 507 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_codecencodings_iso2022.py | # Codec encoding tests for ISO 2022 encodings.
from test import multibytecodec_support
import unittest
COMMON_CODEC_TESTS = (
# invalid bytes
(b'ab\xFFcd', 'replace', 'ab\uFFFDcd'),
(b'ab\x1Bdef', 'replace', 'ab\x1Bdef'),
(b'ab\x1B$def', 'replace', 'ab\uFFFD'),
)
class Test_ISO202... | 1,390 | 42 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_strtod.py | # Tests for the correctly-rounded string -> float conversions
# introduced in Python 2.7 and 3.1.
import random
import unittest
import re
import sys
import test.support
if getattr(sys, 'float_repr_style', '') != 'short':
raise unittest.SkipTest('correctly-rounded string->float conversions '
... | 20,537 | 434 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/badsyntax_future6.py | """This is a test"""
"this isn't a doc string"
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
| 161 | 11 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_doctest2.txt | This is a sample doctest in a text file.
In this example, we'll rely on some silly setup:
>>> import test.test_doctest
>>> test.test_doctest.sillySetup
True
This test also has some (random) encoded (utf-8) unicode text:
ÃÂÃÂÃÂÃÂÃÂ
This doesn't cause a problem in the tect surrounding the exa... | 392 | 15 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_kdf.py | import hashlib
import unittest
import binascii
TRANS_5C = bytes((x ^ 0x5C) for x in range(256))
TRANS_36 = bytes((x ^ 0x36) for x in range(256))
class Pbkdf2Test(unittest.TestCase):
def test_rfc6070_sha1_iter1(self):
self.assertEqual(
'0c60c80f961f0e71f3a9b524af6012062fe037a6',
hashlib.p... | 10,429 | 219 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_fileio.py | # Adapted from test_file.py by Daniel Stutzbach
import sys
import os
import io
import errno
import cosmo
import unittest
from array import array
from weakref import proxy
from functools import wraps
from test.support import (TESTFN, TESTFN_UNICODE, check_warnings, run_unittest,
make_bad_fd, ... | 20,010 | 605 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_userdict.py | # Check every path through every method of UserDict
from test import mapping_tests
import unittest
import collections
d0 = {}
d1 = {"one": 1}
d2 = {"one": 1, "two": 2}
d3 = {"one": 1, "two": 3, "three": 5}
d4 = {"one": None, "two": None}
d5 = {"one": 1, "two": 1}
class UserDictTest(mapping_tests.TestHashMappingProto... | 7,821 | 221 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_file.py | import sys
import os
import unittest
from array import array
from weakref import proxy
import io
import _pyio as pyio
from test.support import TESTFN
from test import support
from collections import UserList
class AutoFileTests:
# file tests for which a test file is automatically set up
def setUp(self):
... | 10,868 | 323 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_devpoll.py | # Test case for the select.devpoll() function
# Initial tests are copied as is from "test_poll.py"
import os
import random
import select
import unittest
from test.support import run_unittest, cpython_only
if not hasattr(select, 'devpoll') :
raise unittest.SkipTest('test works only on Solaris OS family')
def fi... | 4,618 | 146 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_multiprocessing_forkserver.py | import unittest
import test._test_multiprocessing
import sys
from test import support
if support.PGO:
raise unittest.SkipTest("test is not helpful for PGO")
if sys.platform == "win32":
raise unittest.SkipTest("forkserver is not available on Windows")
test._test_multiprocessing.install_tests_in_module_dict(g... | 392 | 17 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/empty.vbs | 'Empty VBS file, does nothing. Helper for Lib\test\test_startfile.py. | 70 | 1 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_shlex.py | import io
import shlex
import string
import unittest
# The original test data set was from shellwords, by Hartmut Goebel.
data = r"""x|x|
foo bar|foo|bar|
foo bar|foo|bar|
foo bar |foo|bar|
foo bar bla fasel|foo|bar|bla|fasel|
x y z xxxx|x|y|z|xxxx|
\x bar|\|x|bar|
\ x bar|\|x|bar|
\ bar|\|... | 11,179 | 319 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_urllib2.py | import unittest
from test import support
from test import test_urllib
import os
import io
import socket
import array
import sys
import tempfile
import subprocess
import urllib.request
# The proxy bypass method imported below has logic specific to the OSX
# proxy config data structure but is testable on all platforms.... | 77,791 | 1,955 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/randv2_64.pck | crandom
Random
p0
(tRp1
(I2
(I2147483648
I1812115682
I2741755497
I1028055730
I809166036
I2773628650
I62321950
I535290043
I349877800
I976167039
I2490696940
I3631326955
I2107991114
I2941205793
I3199611605
I1871971556
I1456108540
I2984591044
I140836801
I4203227310
I3652722980
I4031971234
I555769760
I697301296
I2347638880
... | 7,365 | 633 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/tokenize_tests-no-coding-cookie-and-utf8-bom-sig-only.txt | # 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. ÐÐÐÐÐ
"""
pass
| 303 | 12 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/pydoc_mod.py | """This is a test module for test_pydoc"""
__author__ = "Benjamin Peterson"
__credits__ = "Nobody"
__version__ = "1.2.3.4"
__xyz__ = "X, Y and Z"
class A:
"""Hello and goodbye"""
def __init__():
"""Wow, I have no function!"""
pass
class B(object):
NO_MEANING: str = "eggs"
pass
class ... | 713 | 38 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_math.py | # Python test set -- math module
# XXXX Should not do tests around zero only
from test.support import run_unittest, verbose, requires_IEEE_754
from test import support
import unittest
import math
import os
import platform
import struct
import sys
import sysconfig
eps = 1E-05
NAN = float('nan')
INF = float('inf')
NINF... | 58,806 | 1,417 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_xmlrpc.py | import base64
import datetime
import decimal
import sys
import time
import unittest
from unittest import mock
import xmlrpc.client as xmlrpclib
import xmlrpc.server
import http.client
import http, http.server
import socket
import re
import io
import contextlib
from test import support
from encodings import iso8559_15
... | 55,357 | 1,420 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_dict_version.py | """
Test implementation of the PEP 509: dictionary versionning.
"""
import unittest
from test import support
# PEP 509 is implemented in CPython but other Python implementations
# don't require to implement it
_testcapi = support.import_module('_testcapi')
class DictVersionTests(unittest.TestCase):
type2test = d... | 6,010 | 187 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_urllib.py | """Regression tests for what was in Python 2's "urllib" module"""
import urllib.parse
import urllib.request
import urllib.error
import http.client
import email.message
import io
import unittest
from unittest.mock import patch
from test import support
import os
try:
import ssl
except ImportError:
ssl = None
imp... | 69,510 | 1,676 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_time.py | from test import support
import decimal
import enum
import locale
import math
import platform
import sys
import sysconfig
import time
import unittest
try:
import _thread
import threading
except ImportError:
threading = None
try:
import _testcapi
except ImportError:
_testcapi = None
# Max year is o... | 37,703 | 1,005 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/zip_cp437_header.zip | PK Ãi=n*´ filename_with_o.txtsõwãå PK Ãi=n*´ filename_without.txtsõwãå PK Ãi=n*´ filename_with_o.txtPK Ãi=n*´ : filename_without.txtPK
s | 270 | 1 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_curses.py | #
# Test script for the curses module
#
# This script doesn't actually display anything very coherent. but it
# does call (nearly) every method and function.
#
# Functions not tested: {def,reset}_{shell,prog}_mode, getch(), getstr(),
# init_color()
# Only called, not tested: getmouse(), ungetmouse()
#
import os
import... | 19,302 | 550 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_unicodedata.py | """ Test script for the unicodedata module.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
import sys
import cosmo
import unittest
import hashlib
import unicodedata
from test.support import script_helper
encoding = 'utf-8'
errors = 'surrogatepass'... | 12,556 | 323 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_codecencodings_kr.py | #
# test_codecencodings_kr.py
# Codec encoding tests for ROK encodings.
#
from test import multibytecodec_support
import unittest
class Test_CP949(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'cp949'
tstring = multibytecodec_support.load_teststring('cp949')
codectests = (
# in... | 3,028 | 70 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_richcmp.py | # Tests for rich comparisons
import unittest
import cosmo
from test import support
import operator
class Number:
def __init__(self, x):
self.x = x
def __lt__(self, other):
return self.x < other
def __le__(self, other):
return self.x <= other
def __eq__(self, other):
... | 12,292 | 358 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_pdb.py | # A test suite for pdb; not very comprehensive at the moment.
import doctest
import os
import pdb
import sys
import types
import unittest
import subprocess
import textwrap
from test import support
# This little helper class is essential for testing pdb under doctest.
from test.test_doctest import _FakeInput
class P... | 43,058 | 1,330 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_weakset.py | import unittest
from weakref import WeakSet
import string
from collections import UserString as ustr
import gc
import contextlib
class Foo:
pass
class RefCycle:
def __init__(self):
self.cycle = self
class TestWeakSet(unittest.TestCase):
def setUp(self):
# need to keep references to the... | 15,311 | 440 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt | # -*- coding: utf-8 -*-
# IMPORTANT: unlike the other test_tokenize-*.txt files, this file
# does NOT have the utf-8 BOM signature '\xef\xbb\xbf' at the start
# of it. Make sure this is not added inadvertently by your editor
# if any changes are made to this file!
# Arbitrary encoded utf-8 text (stolen from test_doct... | 421 | 14 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/dis_module.py |
# A simple module for testing the dis module.
def f(): pass
def g(): pass
| 76 | 6 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_doctest4.txt | This is a sample doctest in a text file that contains non-ASCII characters.
This file is encoded using UTF-8.
In order to get this test to pass, we have to manually specify the
encoding.
>>> 'föö'
'f\xf6\xf6'
>>> 'bÄ
r'
'b\u0105r'
| 244 | 12 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_userstring.py | # UserString is a wrapper around the native builtin string type.
# UserString instances should behave similar to builtin string objects.
import unittest
from test import string_tests
from collections import UserString
class UserStringTest(
string_tests.CommonTest,
string_tests.MixinStrUnicodeUserStringTest,
... | 1,469 | 45 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/test_iterlen.py | """ Test Iterator Length Transparency
Some functions or methods which accept general iterable arguments have
optional, more efficient code paths if they know how many items to expect.
For instance, map(func, iterable), will pre-allocate the exact amount of
space required whenever the iterable can report its length.
T... | 7,266 | 229 | jart/cosmopolitan | false |
cosmopolitan/third_party/python/Lib/test/ssl_servers.py | import os
import sys
import ssl
import pprint
import socket
import urllib.parse
# Rename HTTPServer to _HTTPServer so as to avoid confusion with HTTPSServer.
from http.server import (HTTPServer as _HTTPServer,
SimpleHTTPRequestHandler, BaseHTTPRequestHandler)
from test import support
threading = support.import_mod... | 7,255 | 210 | jart/cosmopolitan | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.