Skip to content

Commit 5da1e6c

Browse files
committed
test: skip for version
1 parent f2ee051 commit 5da1e6c

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

tests/test_blocken.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
if sys.version_info >= (3, 12):
2323
from snakefmt.blocken import consume_fstring
24+
py12_guard = pytest.mark.skipif(
25+
sys.version_info < (3, 12), reason="Requires Python 3.12 or higher"
26+
)
2427

2528

2629
def generate_tokens(input: str):
@@ -30,9 +33,9 @@ def generate_tokens(input: str):
3033

3134

3235
class TestTokenIterator:
36+
37+
@py12_guard
3338
def test_fstring1(self):
34-
if sys.version_info < (3, 12):
35-
return
3639
input = 'f"hello world"'
3740
tokens = generate_tokens(input)
3841
token_iter = TokenIterator("", iter(tokens))
@@ -50,9 +53,8 @@ def test_fstring1(self):
5053
tokenize.FSTRING_END,
5154
]
5255

56+
@py12_guard
5357
def test_fstring_with_bracket(self):
54-
if sys.version_info < (3, 12):
55-
return
5658
input = 'a = f"hello {world}"'
5759
tokens = generate_tokens(input)
5860
token_iter = TokenIterator("", iter(tokens))
@@ -91,6 +93,7 @@ def test_consum_all(self):
9193
" pass"
9294
)
9395

96+
@py12_guard
9497
def test_next_new_line(self):
9598
tokens = generate_tokens(self.example1)
9699
token_iter = TokenIterator("", iter(tokens))

0 commit comments

Comments
 (0)