* moved all namedexpr_test related rules to _NamedExprRule

* added valid examples
This commit is contained in:
Jarry Shaw
2019-12-14 09:37:16 +01:00
parent 776e151370
commit 89c4d959e9
2 changed files with 29 additions and 21 deletions

View File

@@ -293,6 +293,19 @@ def test_valid_fstrings(code):
assert not _get_error_list(code, version='3.6')
@pytest.mark.parametrize(
'code', [
'a = (b := 1)',
'[x4 := x ** 5 for x in range(7)]',
'[total := total + v for v in range(10)]',
'while chunk := file.read(2):\n pass',
'numbers = [y := math.factorial(x), y**2, y**3]',
]
)
def test_valid_namedexpr(code):
assert not _get_error_list(code, version='3.8')
@pytest.mark.parametrize(
('code', 'message'), [
("f'{1+}'", ('invalid syntax')),