Remove completed TODO

This commit is contained in:
Jeong YunWon committed 2023-02-13 21:28:19 +09:00
1 parent 2fc0edf85b
commit 4bd090887e
6 files changed
+35 -44

No files matched your search

+1 -1
View File
@@ -22,7 +22,7 @@ assert unicodedata.normalize('NFC', 'bla') == 'bla'
# testing unicodedata.ucd_3_2_0 for idna
assert "abcСĤ".encode("idna") == b'xn--abc-7sa390b'
# TODO: fix: assert "abc䄣IJ".encode("idna") == b'xn--abcij-zb5f'
assert "abc䄣IJ".encode("idna") == b'xn--abcij-zb5f'
# from CPython tests
assert "python.org".encode("idna") == b"python.org"
+4 -6
View File
@@ -8,17 +8,15 @@ assert string.digits == '0123456789'
assert string.hexdigits == '0123456789abcdefABCDEF'
assert string.octdigits == '01234567'
assert string.punctuation == '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
# FIXME
#assert string.whitespace == ' \t\n\r\x0b\x0c', string.whitespace
#assert string.printable == '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
assert string.whitespace == ' \t\n\r\x0b\x0c', string.whitespace
assert string.printable == '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
assert string.capwords('bla bla', ' ') == 'Bla Bla'
from string import Template
s = Template('$who likes $what')
# TODO:
# r = s.substitute(who='tim', what='kung pow')
# print(r)
r = s.substitute(who='tim', what='kung pow')
assert r == 'tim likes kung pow'
from string import Formatter
+11 -13
View File
@@ -193,22 +193,20 @@ class B:
assert B.__doc__ == "Docstring"
# TODO: uncomment once free vars/cells are working
# The symboltable sees that b() is referring to a in the nested scope,
# so it marks it as non local. When it's executed, it walks up the scopes
# and still finds the a from the class scope.
# a = 1
# def nested_scope():
# a = 2
# class A:
# a = 3
# def b():
# assert a == 2
# b()
# assert a == 3
# A.b()
# nested_scope()
a = 1
def nested_scope():
a = 2
class A:
a = 3
def b():
assert a == 2
b()
assert a == 3
A.b()
nested_scope()
# Multiple inheritance and mro tests.
+1 -2
View File
@@ -12,8 +12,7 @@ assert z == [
(3, 2), (3, 5), (3, 10)]
v = {b * 2 for b in x}
# TODO: how to check set equality?
# assert v == {2, 6, 4}
assert v == {2, 6, 4}
u = {str(b): b-2 for b in x}
assert u['3'] == 1
+15 -19
View File
@@ -60,14 +60,13 @@ assert f'{10:{"#"}1{0}{"x"}}' == ' 0xa'
assert f'{-10:-{"#"}1{0}x}' == ' -0xa'
assert f'{-10:{"-"}#{1}0{"x"}}' == ' -0xa'
# TODO:
# spec = "bla"
# assert_raises(ValueError, lambda: f"{16:{spec}}")
spec = "bla"
assert_raises(ValueError, lambda: f"{16:{spec}}")
# Normally `!` cannot appear outside of delimiters in the expression but
# cpython makes an exception for `!=`, so we should too.
# assert f'{1 != 2}' == 'True'
assert f'{1 != 2}' == 'True'
# conversion flags
@@ -103,19 +102,17 @@ assert f'>{v!s}' == '>\u262e'
assert f'>{v!a}' == r">'\u262e'"
# Test format specifier after conversion flag
#assert f'{"42"!s:<5}' == '42 ', '#' + f'{"42"!s:5}' +'#' # TODO: default alignment in cpython is left
assert f'{"42"!s:<5}' == '42 ', '#' + f'{"42"!s:5}' +'#'
assert f'{"42"!s:<5}' == '42 ', '#' + f'{"42"!s:<5}' +'#'
assert f'{"42"!s:>5}' == ' 42', '#' + f'{"42"!s:>5}' +'#'
#assert f'{"42"=!s:5}' == '"42"=42 ', '#'+ f'{"42"=!s:5}' +'#' # TODO default alingment in cpython is left
assert f'{"42"=!s:5}' == '"42"=42 ', '#'+ f'{"42"=!s:5}' +'#'
assert f'{"42"=!s:<5}' == '"42"=42 ', '#'+ f'{"42"=!s:<5}' +'#'
assert f'{"42"=!s:>5}' == '"42"= 42', '#'+ f'{"42"=!s:>5}' +'#'
### Tests for fstring selfdocumenting form CPython
class C:
@@ -126,16 +123,16 @@ self=C()
x = 'A string'
self.assertEqual(f'{10=}', '10=10')
# self.assertEqual(f'{x=}', 'x=' + x )#repr(x)) # TODO: add ' when printing strings
# self.assertEqual(f'{x =}', 'x =' + x )# + repr(x)) # TODO: implement ' handling
self.assertEqual(f'{x=}', 'x=' + repr(x))
self.assertEqual(f'{x =}', 'x =' + repr(x))
self.assertEqual(f'{x=!s}', 'x=' + str(x))
# # self.assertEqual(f'{x=!r}', 'x=' + x) #repr(x)) # !r not supported
# self.assertEqual(f'{x=!a}', 'x=' + ascii(x))
self.assertEqual(f'{x=!r}', 'x=' + repr(x))
self.assertEqual(f'{x=!a}', 'x=' + ascii(x))
x = 2.71828
self.assertEqual(f'{x=:.2f}', 'x=' + format(x, '.2f'))
self.assertEqual(f'{x=:}', 'x=' + format(x, ''))
self.assertEqual(f'{x=!r:^20}', 'x=' + format(repr(x), '^20')) # TODO formatspecifier after conversion flsg is currently not supported (also for classical fstrings)
self.assertEqual(f'{x=!r:^20}', 'x=' + format(repr(x), '^20'))
self.assertEqual(f'{x=!s:^20}', 'x=' + format(str(x), '^20'))
self.assertEqual(f'{x=!a:^20}', 'x=' + format(ascii(x), '^20'))
@@ -170,14 +167,13 @@ self.assertEqual(f'{0<=1}', 'True')
self.assertEqual(f'{0>=1}', 'False')
# Make sure leading and following text works.
# x = 'foo'
#self.assertEqual(f'X{x=}Y', 'Xx='+repr(x)+'Y') # TODO '
# self.assertEqual(f'X{x=}Y', 'Xx='+x+'Y') # just for the moment
x = 'foo'
self.assertEqual(f'X{x=}Y', 'Xx='+repr(x)+'Y')
# Make sure whitespace around the = works.
# self.assertEqual(f'X{x =}Y', 'Xx ='+repr(x)+'Y') # TODO '
# self.assertEqual(f'X{x= }Y', 'Xx= '+repr(x)+'Y') # TODO '
# self.assertEqual(f'X{x = }Y', 'Xx = '+repr(x)+'Y') # TODO '
self.assertEqual(f'X{x =}Y', 'Xx ='+repr(x)+'Y')
self.assertEqual(f'X{x= }Y', 'Xx= '+repr(x)+'Y')
self.assertEqual(f'X{x = }Y', 'Xx = '+repr(x)+'Y')
# self.assertEqual(f'X{x =}Y', 'Xx ='+x+'Y')
# self.assertEqual(f'X{x= }Y', 'Xx= '+x+'Y')
+3 -3
View File
@@ -102,9 +102,9 @@ def binary(n):
with assert_raises(StopIteration):
try:
next(binary(5))
except StopIteration as stopiter:
# TODO: StopIteration.value
assert stopiter.args[0] == 31
except StopIteration as stop_iter:
assert stop_iter.value == 31
assert stop_iter.args[0] == 31
raise
class SpamException(Exception):