From 3c6e378cc46b7b20c6329e7e7b2a50d90ff381f4 Mon Sep 17 00:00:00 2001 From: rocky Date: Wed, 10 Jul 2024 13:31:39 -0400 Subject: [PATCH] Spelling corrections --- test/ok_lib2.7/bsddb/dbshelve.py | 5 +++-- test/simple_source/bug26/03_weird26.py | 4 ++-- test/simple_source/bug27+/01_module_doc.py | 4 ++-- test/simple_source/bug30/01_ops.py | 12 +++++------ .../bug33/04_lambda_star_default.py | 10 ++++++---- test/simple_source/bug33/08_if_else.py | 20 +++++++++++-------- test/simple_source/bug35/06_while_return.py | 4 +++- test/simple_source/bug36/03_fn_defaults.py | 9 ++++++++- test/simple_source/bug36/04_class_kwargs.py | 10 ++++++++-- test/simple_source/bug36/05_if_and_comp.py | 8 ++++---- test/simple_source/bug36/10_fstring.py | 4 +++- test/simple_source/bug36/10_long_pop_jump.py | 16 +++++++-------- test/simple_source/calls/01_positional.py | 2 +- .../simple_source/looping/04_while1_while1.py | 2 +- .../operation_logic/05_control_flow_bugs.py | 12 +++++++++-- .../operation_logic/10_mixed_boolean.py | 14 ++++++------- test/simple_source/stmts/03_if_elif.py | 6 ++++-- 17 files changed, 88 insertions(+), 54 deletions(-) diff --git a/test/ok_lib2.7/bsddb/dbshelve.py b/test/ok_lib2.7/bsddb/dbshelve.py index 7d0daa2f..60469b6a 100644 --- a/test/ok_lib2.7/bsddb/dbshelve.py +++ b/test/ok_lib2.7/bsddb/dbshelve.py @@ -29,6 +29,7 @@ storage. #------------------------------------------------------------------------ import sys + absolute_import = (sys.version_info[0] >= 3) if absolute_import : # Because this syntaxis is not valid before Python 2.5 @@ -229,7 +230,7 @@ class DBShelf(MutableMapping): def associate(self, secondaryDB, callback, flags=0): def _shelf_callback(priKey, priData, realCallback=callback): - # Safe in Python 2.x because expresion short circuit + # Safe in Python 2.x because expression short circuit if sys.version_info[0] < 3 or isinstance(priData, bytes) : data = cPickle.loads(priData) else : @@ -366,7 +367,7 @@ class DBShelfCursor: return None else: key, data = rec - # Safe in Python 2.x because expresion short circuit + # Safe in Python 2.x because expression short circuit if sys.version_info[0] < 3 or isinstance(data, bytes) : return key, cPickle.loads(data) else : diff --git a/test/simple_source/bug26/03_weird26.py b/test/simple_source/bug26/03_weird26.py index 9b583eed..b0c97df1 100644 --- a/test/simple_source/bug26/03_weird26.py +++ b/test/simple_source/bug26/03_weird26.py @@ -3,10 +3,10 @@ # Grammar allows multiple adjacent 'if's in listcomps and genexps, # even though it's silly. Make sure it works (ifelse broke this.) -[ x for x in range(10) if x % 2 if x % 3 ] +[x for x in range(10) if x % 2 if x % 3] list(x for x in range(10) if x % 2 if x % 3) -# expresion which evaluates True unconditionally, +# expression which evaluates True unconditionally, # but leave dead code or junk around that we have to match on. # Tests "if_exp_true" rule 5 if 1 else 2 diff --git a/test/simple_source/bug27+/01_module_doc.py b/test/simple_source/bug27+/01_module_doc.py index 0ceef372..d2e3282d 100644 --- a/test/simple_source/bug27+/01_module_doc.py +++ b/test/simple_source/bug27+/01_module_doc.py @@ -1,8 +1,8 @@ # From 2.7.17 test_bdb.py -# The problem was detecting a docstring at the begining of the module +# The problem was detecting a docstring at the beginning of the module # It must be detected and change'd or else the "from __future__" below # is invalid. -# Note that this has to be compiled with optimation < 2 or else optimization +# Note that this has to be compiled with optimization < 2 or else optimization # will remove the docstring """Rational, infinite-precision, real numbers.""" diff --git a/test/simple_source/bug30/01_ops.py b/test/simple_source/bug30/01_ops.py index c984b3dd..6536b180 100644 --- a/test/simple_source/bug30/01_ops.py +++ b/test/simple_source/bug30/01_ops.py @@ -1,20 +1,20 @@ # Statements to beef up grammar coverage rules # Force "inplace" ops # Note this is like simple_source/bug22/01_ops.py -# But we don't ahve the UNARY_CONVERT which dropped +# But we don't have the UNARY_CONVERT which dropped # out around 2.7 y = +10 # UNARY_POSITIVE -y /= 1 # INPLACE_DIVIDE -y %= 4 # INPLACE_MODULO +y /= 1 # INPLACE_DIVIDE +y %= 4 # INPLACE_MODULO y **= 1 # INPLACE POWER y >>= 2 # INPLACE_RSHIFT y <<= 2 # INPLACE_LSHIFT y //= 1 # INPLACE_TRUE_DIVIDE -y &= 1 # INPLACE_AND -y ^= 1 # INPLACE_XOR +y &= 1 # INPLACE_AND +y ^= 1 # INPLACE_XOR # Beef up aug_assign and STORE_SLICE+3 -x = [1,2,3,4,5] +x = [1, 2, 3, 4, 5] x[0:1] = 1 x[0:3] += 1, 2, 3 diff --git a/test/simple_source/bug33/04_lambda_star_default.py b/test/simple_source/bug33/04_lambda_star_default.py index 879b8960..a1e2db67 100644 --- a/test/simple_source/bug33/04_lambda_star_default.py +++ b/test/simple_source/bug33/04_lambda_star_default.py @@ -1,18 +1,20 @@ # From 3.x test_audiop.py # Bug is handling default value after * argument in a lambda. -# That's a mouthful of desciption; I am not sure if the really +# That's a mouthful of description; I am not sure if the really # hacky fix to the code is even correct. # # FIXME: try and test with more than one default argument. + # RUNNABLE def pack(width, data): return (width, data) + packs = {w: (lambda *data, width=w: pack(width, data)) for w in (1, 2, 4)} -assert packs[1]('a') == (1, ('a',)) -assert packs[2]('b') == (2, ('b',)) -assert packs[4]('c') == (4, ('c',)) +assert packs[1]("a") == (1, ("a",)) +assert packs[2]("b") == (2, ("b",)) +assert packs[4]("c") == (4, ("c",)) diff --git a/test/simple_source/bug33/08_if_else.py b/test/simple_source/bug33/08_if_else.py index abb104de..d16da5b8 100644 --- a/test/simple_source/bug33/08_if_else.py +++ b/test/simple_source/bug33/08_if_else.py @@ -1,16 +1,19 @@ # From python 3.3.7 trace # Bug was not having not having semantic rule for conditional not + # RUNNABLE! def init(modules=None): mods = set() if not modules else set(modules) return mods + assert init() == set() assert init([1, 2, 3]) == set([1, 2, 3]) + # From 3.6 sre_parse -# Bug was in handling multple COME_FROMS from nested if's +# Bug was in handling multiple COME_FROMS from nested if's def _escape(a, b, c, d, e): if a: if b: @@ -24,15 +27,16 @@ def _escape(a, b, c, d, e): return raise -assert _escape(False, True, True, True, True) is None -assert _escape(True, True, True, False, True) is None -assert _escape(True, True, False, False, True) is None + +assert _escape(False, True, True, True, True) is None +assert _escape(True, True, True, False, True) is None +assert _escape(True, True, False, False, True) is None for args in ( - (True, True, True, False, True), - (True, False, True, True, True), - (True, False, True, True, False), - ): + (True, True, True, False, True), + (True, False, True, True, True), + (True, False, True, True, False), +): try: _escape(*args) assert False, args diff --git a/test/simple_source/bug35/06_while_return.py b/test/simple_source/bug35/06_while_return.py index 735065f7..a08949de 100644 --- a/test/simple_source/bug35/06_while_return.py +++ b/test/simple_source/bug35/06_while_return.py @@ -1,8 +1,9 @@ # From Python 3.4 asynchat.py -# Tests presence or absense of +# Tests presence or absence of # SETUP_LOOP testexpr return_stmts POP_BLOCK COME_FROM_LOOP # Note: that there is no JUMP_BACK because of the return_stmts. + def initiate_send(a, b, c, num_sent): while a and b: try: @@ -24,6 +25,7 @@ def initiate_send2(a, b): return 2 + assert initiate_send(1, 1, 2, False) == 1 assert initiate_send(1, 2, 3, False) == 3 assert initiate_send(1, 2, 3, True) == 2 diff --git a/test/simple_source/bug36/03_fn_defaults.py b/test/simple_source/bug36/03_fn_defaults.py index 6167ce0c..af27ee25 100644 --- a/test/simple_source/bug36/03_fn_defaults.py +++ b/test/simple_source/bug36/03_fn_defaults.py @@ -1,13 +1,20 @@ -# Python 3.6 changes, yet again, the way deafult pairs are handled +# Python 3.6 changes, yet again, the way default pairs are handled def foo1(bar, baz=1): return 1 + + def foo2(bar, baz, qux=1): return 2 + + def foo3(bar, baz=1, qux=2): return 3 + + def foo4(bar, baz, qux=1, quux=2): return 4 + # From 3.6 compileall. # Bug was in omitting default which when used in an "if" # are treated as False would be diff --git a/test/simple_source/bug36/04_class_kwargs.py b/test/simple_source/bug36/04_class_kwargs.py index 55797a27..36072659 100644 --- a/test/simple_source/bug36/04_class_kwargs.py +++ b/test/simple_source/bug36/04_class_kwargs.py @@ -1,17 +1,23 @@ # From 3.6 test_abc.py -# Bug was Reciever() class definition +# Bug was Receiver() class definition import abc import unittest + + class TestABCWithInitSubclass(unittest.TestCase): def test_works_with_init_subclass(self): class ReceivesClassKwargs: def __init_subclass__(cls, **kwargs): super().__init_subclass__() + class Receiver(ReceivesClassKwargs, abc.ABC, x=1, y=2, z=3): pass + def test_abstractmethod_integration(self): for abstractthing in [abc.abstractmethod]: + class C(metaclass=abc.ABCMeta): @abstractthing - def foo(self): pass # abstract + def foo(self): + pass # abstract diff --git a/test/simple_source/bug36/05_if_and_comp.py b/test/simple_source/bug36/05_if_and_comp.py index 9c4bc61d..b2959451 100644 --- a/test/simple_source/bug36/05_if_and_comp.py +++ b/test/simple_source/bug36/05_if_and_comp.py @@ -1,12 +1,12 @@ # From 3.6 base64.py -# Bug was handling "and" condition in the presense of POP_JUMP_IF_FALSE +# Bug was handling "and" condition in the presence of POP_JUMP_IF_FALSE # locations def _85encode(foldnuls, words): - return ['z' if foldnuls and word - else 'y' - for word in words] + return ["z" if foldnuls and word else "y" for word in words] + # From Python 3.6 enum.py + def __new__(metacls, cls, bases, classdict): {k: classdict[k] for k in classdict._member_names} diff --git a/test/simple_source/bug36/10_fstring.py b/test/simple_source/bug36/10_fstring.py index 52f79481..9a93db7e 100644 --- a/test/simple_source/bug36/10_fstring.py +++ b/test/simple_source/bug36/10_fstring.py @@ -14,6 +14,7 @@ assert ( assert "def0" == f"{abc}0" assert "defdef" == f"{abc}{abc!s}" + # From 3.8 test/test_string.py # We had the precedence of yield vs. lambda incorrect. def fn(x): @@ -97,9 +98,10 @@ else: (x, y, width) = ("foo", 2, 10) assert f"x={x*y:{width}}" == "x=foofoo " + # Why the fact that the distinction of docstring versus stmt is a # string expression is important academic, but we will decompile an -# equivalent thing. For compatiblity with older Python we'll use "%" +# equivalent thing. For compatibility with older Python we'll use "%" # instead of a format string def f(): f"""Not a docstring""" # noqa diff --git a/test/simple_source/bug36/10_long_pop_jump.py b/test/simple_source/bug36/10_long_pop_jump.py index ad6c4de7..da6a1981 100644 --- a/test/simple_source/bug36/10_long_pop_jump.py +++ b/test/simple_source/bug36/10_long_pop_jump.py @@ -1,26 +1,27 @@ # From 3.6 _markupbase.py -# Bug is that the routine is long enough that POP_JUMP_IF_FALSE instruciton has an -# EXTENDED_ARG intruction before it and we weren't picking out the jump offset properly +# Bug is that the routine is long enough that POP_JUMP_IF_FALSE instruction has an +# EXTENDED_ARG instruction before it and we weren't picking out the jump offset properly + def parse_declaration(self, i): if rawdata[j:j] in ("-", ""): return -1 n = len(rawdata) - if rawdata[j:j+2] == '-': + if rawdata[j : j + 2] == "-": return self.parse_comment(i) - elif rawdata[j] == '[': + elif rawdata[j] == "[": return self.parse_marked_section(i) else: decltype, j = self._scan_name(j, i) if j < 0: return j if decltype == "d": - self._decl_otherchars = '' + self._decl_otherchars = "" while j < n: c = rawdata[j] if c == ">": - data = rawdata[i+2:j] + data = rawdata[i + 2 : j] if decltype == "d": self.handle_decl(data) else: @@ -43,8 +44,7 @@ def parse_declaration(self, i): else: self.error("unexpected '[' char in declaration") else: - self.error( - "unexpected %r char in declaration" % rawdata[j]) + self.error("unexpected %r char in declaration" % rawdata[j]) if j < 0: return j return -1 diff --git a/test/simple_source/calls/01_positional.py b/test/simple_source/calls/01_positional.py index 3cc17e25..9527bf89 100644 --- a/test/simple_source/calls/01_positional.py +++ b/test/simple_source/calls/01_positional.py @@ -1,5 +1,5 @@ # Tests custom added grammar rule: # expr ::= expr {expr}^n CALL_FUNCTION_n -# which in the specifc case below is: +# which in the specific case below is: # expr ::= expr expr expr CALL_FUNCTION_2 max(1, 2) diff --git a/test/simple_source/looping/04_while1_while1.py b/test/simple_source/looping/04_while1_while1.py index 41106b0c..bb8762cc 100644 --- a/test/simple_source/looping/04_while1_while1.py +++ b/test/simple_source/looping/04_while1_while1.py @@ -27,7 +27,7 @@ while 1: else: raise RuntimeError -# Degenerate case. Note: we can't run becase this causes an infinite loop. +# Degenerate case. Note: we can't run because this causes an infinite loop. # Suggested in issue #172 while 1: pass diff --git a/test/simple_source/operation_logic/05_control_flow_bugs.py b/test/simple_source/operation_logic/05_control_flow_bugs.py index f756f2ad..5d89100d 100644 --- a/test/simple_source/operation_logic/05_control_flow_bugs.py +++ b/test/simple_source/operation_logic/05_control_flow_bugs.py @@ -1,7 +1,8 @@ # From 3.6.10 test_binascii.py -# Bug was getting "while c and noise" parsed correclty +# Bug was getting "while c and noise" parsed correctly # and not put into the "ifelsesmt" + # RUNNABLE! def addnoise(c, noise): while c and noise: @@ -12,6 +13,7 @@ def addnoise(c, noise): noise = False return c + assert addnoise(0, True) == 0 assert addnoise(1, False) == 1 assert addnoise(2, True) == 2 @@ -19,9 +21,10 @@ assert addnoise(3, True) == 3 assert addnoise(4, True) == 3 assert addnoise(5, False) == 5 + # From 3.6.10 test_dbm_dumb.py # Bug was getting attaching "else" to the right "if" in the -# presense of a loop. +# presence of a loop. def test_random(a, r): x = 0 for dummy in r: @@ -32,11 +35,13 @@ def test_random(a, r): x += 1 return x + assert test_random(True, [1]) == 2 assert test_random(True, [1, 1]) == 4 assert test_random(False, [1]) == 0 assert test_random(False, [1, 1]) == 0 + # From 2.7.17 test_frozen.py # Bug was getting making sure we have "try" not # "try"/"else" @@ -53,11 +58,13 @@ def test_frozen(a, b): return x + assert test_frozen(1, 1) == 4.0 assert test_frozen(0, 1) == 5.0 assert test_frozen(0.5, 0) == 6.0 assert test_frozen(0, 0.5) == 8.0 + # From 3.6.10 test_binop.py # Bug was getting "other += 3" outside of "if"/"else. def __floordiv__(a, b): @@ -70,6 +77,7 @@ def __floordiv__(a, b): other += 3 return other + assert __floordiv__(True, True) == 4 assert __floordiv__(True, False) == 4 assert __floordiv__(False, True) == 3 diff --git a/test/simple_source/operation_logic/10_mixed_boolean.py b/test/simple_source/operation_logic/10_mixed_boolean.py index d1849cda..35d64bef 100644 --- a/test/simple_source/operation_logic/10_mixed_boolean.py +++ b/test/simple_source/operation_logic/10_mixed_boolean.py @@ -1,19 +1,19 @@ # Self-checking test. -# Mixed boolean expresions +# Mixed boolean expressions b = True -assert b, 'b = True' +assert b, "b = True" c = False -assert not c, 'c = False' +assert not c, "c = False" d = True a = b and c or d -assert a, 'b and c or d' +assert a, "b and c or d" a = (b or c) and d -assert a, '(b or c) and d' +assert a, "(b or c) and d" a = b or c or d -assert a, 'b or c or d' +assert a, "b or c or d" a = b and c and d -assert not a, 'b and c and d' +assert not a, "b and c and d" a = b or c and d assert a a = b and (c or d) diff --git a/test/simple_source/stmts/03_if_elif.py b/test/simple_source/stmts/03_if_elif.py index 615a1b72..df51f39c 100644 --- a/test/simple_source/stmts/03_if_elif.py +++ b/test/simple_source/stmts/03_if_elif.py @@ -1,5 +1,5 @@ # 2.6.9 symbols.py -# Bug in 2.6 is having multple COME_FROMs due to the +# Bug in 2.6 is having multiple COME_FROMs due to the # "and" in the "if" clause # RUNNABLE @@ -10,7 +10,7 @@ if __name__: assert False # 2.6.9 transformer.py -# Bug in 2.6 is multple COME_FROMs as a result +# Bug in 2.6 is multiple COME_FROMs as a result # of the "or" in the "assert" # In PyPy the assert is handled via PyPy's unique JUMP_IF_NOT_DEBUG @@ -24,6 +24,7 @@ elif __file__: else: pass + # From 3.3.7 test_binop.py # Bug was in ifelsestmt(c) ensuring b+=5 is not in "else" # Also note: ifelsetmtc should not have been used since this @@ -36,6 +37,7 @@ def __floordiv__(a, b): b += 5 return b + assert __floordiv__(1, 1) == 7 assert __floordiv__(1, 0) == 6 assert __floordiv__(0, 3) == 8