mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-16 23:50:32 +00:00
Make numerous improvements
- Python static hello world now 1.8mb - Python static fully loaded now 10mb - Python HTTPS client now uses MbedTLS - Python REPL now completes import stmts - Increase stack size for Python for now - Begin synthesizing posixpath and ntpath - Restore Python \N{UNICODE NAME} support - Restore Python NFKD symbol normalization - Add optimized code path for Intel SHA-NI - Get more Python unit tests passing faster - Get Python help() pagination working on NT - Python hashlib now supports MbedTLS PBKDF2 - Make memcpy/memmove/memcmp/bcmp/etc. faster - Add Mersenne Twister and Vigna to LIBC_RAND - Provide privileged __printf() for error code - Fix zipos opendir() so that it reports ENOTDIR - Add basic chmod() implementation for Windows NT - Add Cosmo's best functions to Python cosmo module - Pin function trace indent depth to that of caller - Show memory diagram on invalid access in MODE=dbg - Differentiate stack overflow on crash in MODE=dbg - Add stb_truetype and tools for analyzing font files - Upgrade to UNICODE 13 and reduce its binary footprint - COMPILE.COM now logs resource usage of build commands - Start implementing basic poll() support on bare metal - Set getauxval(AT_EXECFN) to GetModuleFileName() on NT - Add descriptions to strerror() in non-TINY build modes - Add COUNTBRANCH() macro to help with micro-optimizations - Make error / backtrace / asan / memory code more unbreakable - Add fast perfect C implementation of μ-Law and a-Law audio codecs - Make strtol() functions consistent with other libc implementations - Improve Linenoise implementation (see also github.com/jart/bestline) - COMPILE.COM now suppresses stdout/stderr of successful build commands
This commit is contained in:
parent
fa7b4f5bd1
commit
39bf41f4eb
806 changed files with 77494 additions and 63859 deletions
37
third_party/python/Lib/test/test_unicodedata.py
vendored
37
third_party/python/Lib/test/test_unicodedata.py
vendored
|
@ -7,8 +7,10 @@
|
|||
"""
|
||||
|
||||
import sys
|
||||
import cosmo
|
||||
import unittest
|
||||
import hashlib
|
||||
import unicodedata
|
||||
from test.support import script_helper
|
||||
|
||||
encoding = 'utf-8'
|
||||
|
@ -20,8 +22,10 @@ errors = 'surrogatepass'
|
|||
class UnicodeMethodsTest(unittest.TestCase):
|
||||
|
||||
# update this, if the database changes
|
||||
expectedchecksum = 'c1fa98674a683aa8a8d8dee0c84494f8d36346e6'
|
||||
|
||||
if unicodedata.unidata_version == '9.0.0':
|
||||
expectedchecksum = 'c1fa98674a683aa8a8d8dee0c84494f8d36346e6'
|
||||
else:
|
||||
expectedchecksum = '963069fe950f9ece86a4bf04ae3d0e705d9a5d12'
|
||||
def test_method_checksum(self):
|
||||
h = hashlib.sha1()
|
||||
for i in range(0x10000):
|
||||
|
@ -80,7 +84,10 @@ class UnicodeFunctionsTest(UnicodeDatabaseTest):
|
|||
|
||||
# Update this if the database changes. Make sure to do a full rebuild
|
||||
# (e.g. 'make distclean && make') to get the correct checksum.
|
||||
expectedchecksum = 'f891b1e6430c712531b9bc935a38e22d78ba1bf3'
|
||||
if unicodedata.unidata_version == '9.0.0':
|
||||
expectedchecksum = 'f891b1e6430c712531b9bc935a38e22d78ba1bf3'
|
||||
else:
|
||||
expectedchecksum = '7d4726cea1a3eb811af289489beea66f225cc251'
|
||||
def test_function_checksum(self):
|
||||
data = []
|
||||
h = hashlib.sha1()
|
||||
|
@ -120,13 +127,15 @@ class UnicodeFunctionsTest(UnicodeDatabaseTest):
|
|||
self.assertEqual(self.db.numeric('\u215b'), 0.125)
|
||||
self.assertEqual(self.db.numeric('\u2468'), 9.0)
|
||||
self.assertEqual(self.db.numeric('\ua627'), 7.0)
|
||||
self.assertEqual(self.db.numeric('\U00020000', None), None)
|
||||
self.assertEqual(self.db.numeric('\U0001012A'), 9000)
|
||||
|
||||
self.assertRaises(TypeError, self.db.numeric)
|
||||
self.assertRaises(TypeError, self.db.numeric, 'xx')
|
||||
self.assertRaises(ValueError, self.db.numeric, 'x')
|
||||
|
||||
@unittest.skipIf(cosmo.MODE == 'tiny', 'astral planes arent tiny')
|
||||
def test_numeric_astral(self):
|
||||
self.assertEqual(self.db.numeric('\U00020000', None), None)
|
||||
self.assertEqual(self.db.numeric('\U0001012A'), 9000)
|
||||
|
||||
def test_decimal(self):
|
||||
self.assertEqual(self.db.decimal('A',None), None)
|
||||
self.assertEqual(self.db.decimal('9'), 9)
|
||||
|
@ -241,22 +250,6 @@ class UnicodeFunctionsTest(UnicodeDatabaseTest):
|
|||
|
||||
class UnicodeMiscTest(UnicodeDatabaseTest):
|
||||
|
||||
# # TODO(jart): pycomp.com needs \N thing
|
||||
# def test_failed_import_during_compiling(self):
|
||||
# # Issue 4367
|
||||
# # Decoding \N escapes requires the unicodedata module. If it can't be
|
||||
# # imported, we shouldn't segfault.
|
||||
# # This program should raise a SyntaxError in the eval.
|
||||
# code = "import sys;" \
|
||||
# "sys.modules['unicodedata'] = None;" \
|
||||
# """eval("'\\\\N{SOFT HYPHEN}'")"""
|
||||
# # We use a separate process because the unicodedata module may already
|
||||
# # have been loaded in this process.
|
||||
# result = script_helper.assert_python_failure("-c", code)
|
||||
# error = "SyntaxError: (unicode error) \\N escapes not supported " \
|
||||
# "(can't load unicodedata module)"
|
||||
# self.assertIn(error, result.err.decode("ascii"))
|
||||
|
||||
def test_decimal_numeric_consistent(self):
|
||||
# Test that decimal and numeric are consistent,
|
||||
# i.e. if a character has a decimal value,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue