diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py index d9d85fe79..483d5ad5f 100644 --- a/Lib/test/test_extcall.py +++ b/Lib/test/test_extcall.py @@ -442,7 +442,7 @@ TypeError if te dictionary is not empty ... False True - >>> id(1, **{'foo': 1}) + >>> id(1, **{'foo': 1}) # TODO: RUSTPYTHON # doctest:+EXPECTED_FAILURE Traceback (most recent call last): ... TypeError: id() takes no keyword arguments @@ -545,8 +545,15 @@ Same with keyword only args: import doctest import unittest +EXPECTED_FAILURE = doctest.register_optionflag('EXPECTED_FAILURE') # TODO: RUSTPYTHON +class CustomOutputChecker(doctest.OutputChecker): # TODO: RUSTPYTHON + def check_output(self, want, got, optionflags): # TODO: RUSTPYTHON + if optionflags & EXPECTED_FAILURE: # TODO: RUSTPYTHON + return not super().check_output(want, got, optionflags) # TODO: RUSTPYTHON + return super().check_output(want, got, optionflags) # TODO: RUSTPYTHON + def load_tests(loader, tests, pattern): - tests.addTest(doctest.DocTestSuite()) + tests.addTest(doctest.DocTestSuite(checker=CustomOutputChecker())) # TODO: RUSTPYTHON return tests diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py index 9e2d54bd3..d84befd9c 100644 --- a/Lib/test/test_unpack_ex.py +++ b/Lib/test/test_unpack_ex.py @@ -148,27 +148,27 @@ List comprehension element unpacking [0, 1, 2, 3, 4] >>> l = [a, (3, 4), {5}, {6: None}, (i for i in range(7, 10))] - >>> [*item for item in l] + >>> [*item for item in l] # TODO: RUSTPYTHON # doctest:+EXPECTED_FAILURE Traceback (most recent call last): ... SyntaxError: iterable unpacking cannot be used in comprehension - >>> [*[0, 1] for i in range(10)] + >>> [*[0, 1] for i in range(10)] # TODO: RUSTPYTHON # doctest:+EXPECTED_FAILURE Traceback (most recent call last): ... SyntaxError: iterable unpacking cannot be used in comprehension - >>> [*'a' for i in range(10)] + >>> [*'a' for i in range(10)] # TODO: RUSTPYTHON # doctest:+EXPECTED_FAILURE Traceback (most recent call last): ... SyntaxError: iterable unpacking cannot be used in comprehension - >>> [*[] for i in range(10)] + >>> [*[] for i in range(10)] # TODO: RUSTPYTHON # doctest:+EXPECTED_FAILURE Traceback (most recent call last): ... SyntaxError: iterable unpacking cannot be used in comprehension - >>> {**{} for a in [1]} + >>> {**{} for a in [1]} # TODO: RUSTPYTHON # doctest:+EXPECTED_FAILURE Traceback (most recent call last): ... SyntaxError: dict unpacking cannot be used in dict comprehension @@ -356,27 +356,27 @@ Now some general starred expressions (all fail). ... SyntaxError: can't use starred expression here - >>> (*x),y = 1, 2 # doctest:+ELLIPSIS + >>> (*x),y = 1, 2 # TODO: RUSTPYTHON # doctest:+ELLIPSIS +EXPECTED_FAILURE Traceback (most recent call last): ... SyntaxError: cannot use starred expression here - >>> (((*x))),y = 1, 2 # doctest:+ELLIPSIS + >>> (((*x))),y = 1, 2 # TODO: RUSTPYTHON # doctest:+ELLIPSIS +EXPECTED_FAILURE Traceback (most recent call last): ... SyntaxError: cannot use starred expression here - >>> z,(*x),y = 1, 2, 4 # doctest:+ELLIPSIS + >>> z,(*x),y = 1, 2, 4 # TODO: RUSTPYTHON # doctest:+ELLIPSIS +EXPECTED_FAILURE Traceback (most recent call last): ... SyntaxError: cannot use starred expression here - >>> z,(*x) = 1, 2 # doctest:+ELLIPSIS + >>> z,(*x) = 1, 2 # TODO: RUSTPYTHON # doctest:+ELLIPSIS +EXPECTED_FAILURE Traceback (most recent call last): ... SyntaxError: cannot use starred expression here - >>> ((*x),y) = 1, 2 # doctest:+ELLIPSIS + >>> ((*x),y) = 1, 2 # TODO: RUSTPYTHON # doctest:+ELLIPSIS +EXPECTED_FAILURE Traceback (most recent call last): ... SyntaxError: cannot use starred expression here @@ -402,8 +402,15 @@ Some size constraints (all fail.) __test__ = {'doctests' : doctests} +EXPECTED_FAILURE = doctest.register_optionflag('EXPECTED_FAILURE') # TODO: RUSTPYTHON +class CustomOutputChecker(doctest.OutputChecker): # TODO: RUSTPYTHON + def check_output(self, want, got, optionflags): # TODO: RUSTPYTHON + if optionflags & EXPECTED_FAILURE: # TODO: RUSTPYTHON + return not super().check_output(want, got, optionflags) # TODO: RUSTPYTHON + return super().check_output(want, got, optionflags) # TODO: RUSTPYTHON + def load_tests(loader, tests, pattern): - tests.addTest(doctest.DocTestSuite()) + tests.addTest(doctest.DocTestSuite(checker=CustomOutputChecker())) # TODO: RUSTPYTHON return tests diff --git a/crates/codegen/src/compile.rs b/crates/codegen/src/compile.rs index 26220f415..70ff6d391 100644 --- a/crates/codegen/src/compile.rs +++ b/crates/codegen/src/compile.rs @@ -7417,7 +7417,7 @@ impl Compiler { && matches!(arguments.args[0], ast::Expr::Starred(_)) { // Single starred arg: pass value directly to CallFunctionEx. - // Runtime will convert to tuple and check iterability with function name. + // Runtime will convert to tuple and validate with function name. if let ast::Expr::Starred(ast::ExprStarred { value, .. }) = &arguments.args[0] { self.compile_expression(value)?; }