Skip to content

Commit

Permalink
test_expand: Add example for annotated assignment without value
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Jun 19, 2022
1 parent 15af535 commit 0488436
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions setuptools/tests/config/test_expand.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,17 @@ def test_read_attr(self, tmp_path, monkeypatch):
values = expand.read_attr('lib.mod.VALUES', {'lib': 'pkg/sub'}, tmp_path)
assert values['c'] == (0, 1, 1)

def test_read_annotated_attr(self, tmp_path):
@pytest.mark.parametrize(
"example",
[
"VERSION: str\nVERSION = '0.1.1'\nraise SystemExit(1)\n",
"VERSION: str = '0.1.1'\nraise SystemExit(1)\n",
]
)
def test_read_annotated_attr(self, tmp_path, example):
files = {
"pkg/__init__.py": "",
"pkg/sub/__init__.py": (
"VERSION: str = '0.1.1'\n"
"raise SystemExit(1)\n"
),
"pkg/sub/__init__.py": example,
}
write_files(files, tmp_path)
# Make sure this attribute can be read statically
Expand Down

0 comments on commit 0488436

Please sign in to comment.