Skip to content
This repository was archived by the owner on Feb 19, 2023. It is now read-only.

Commit 68e0fa9

Browse files
author
Vitor Serpa
committed
Fix coverage
1 parent fb16d3d commit 68e0fa9

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

pandas_dev_flaker/_ast_helpers.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@ def check_for_wrong_alias(
3636
def is_str_constant(
3737
node: ast.Call,
3838
) -> bool:
39-
if isinstance(node.func, ast.Attribute):
40-
if sys.version_info.major == 3 and sys.version_info.minor < 8:
41-
return isinstance(node.func.value, ast.Str)
42-
else:
43-
return isinstance(node.func.value, ast.Constant) and isinstance(
44-
node.func.value.value,
45-
str,
46-
)
47-
else:
48-
return False
39+
python_version = float(sys.version_info.major) + 0.1 * float(
40+
sys.version_info.minor,
41+
)
42+
return isinstance(node.func, ast.Attribute) and (
43+
(python_version < 3.8 and isinstance(node.func.value, ast.Str))
44+
or (
45+
python_version >= 3.8
46+
and isinstance(node.func.value, ast.Constant)
47+
and isinstance(node.func.value.value, str)
48+
)
49+
)

0 commit comments

Comments
 (0)