Skip to content

Commit 80a9710

Browse files
committed
fixed clippy; tests fail explicitly for python 3.7 and below
1 parent 3e8cde7 commit 80a9710

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

parser/src/fstring.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ impl<'a> FStringParser<'a> {
171171
return Ok(Joined {
172172
values: vec![
173173
Constant {
174-
value: pred_expression_text.to_owned() + "=",
174+
value: pred_expression_text + "=",
175175
},
176176
Constant {
177-
value: trailing_seq.to_owned(),
177+
value: trailing_seq,
178178
},
179179
FormattedValue {
180180
value: Box::new(

tests/snippets/fstrings.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
#from testutils import assert_raises
1+
from testutils import assert_raises
2+
3+
#test only makes sense with python 3.8 or higher (or RustPython)
4+
import sys
5+
import platform
6+
if platform.python_implementation() == 'CPython':
7+
assert sys.version_info.major == 3, 'Incompatible Python Version, expected CPython 3.8 or later'
8+
assert sys.version_info.minor == 8, 'Incompatible Python Version, expected CPython 3.8 or later'
9+
elif platform.python_implementation == 'RustPython':
10+
# ok
11+
pass
12+
else:
13+
# other implementation - lets give it a try
14+
pass
15+
16+
17+
# lets start tersing
218
foo = 'bar'
319

420
assert f"{''}" == ''
@@ -25,7 +41,7 @@
2541

2642
f'{num=}' # keep this line as it will fail when using a python 3.7 interpreter
2743

28-
assert f'{num=}' == 'num=42',
44+
assert f'{num=}' == 'num=42'
2945
assert f'{num=:>10}' == 'num= 42'
3046

3147

0 commit comments

Comments
 (0)