Skip to content

Commit

Permalink
Merge 7e533ca into 9d399a9
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJCLaw authored Sep 17, 2023
2 parents 9d399a9 + 7e533ca commit b017288
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 25 deletions.
5 changes: 1 addition & 4 deletions test/test_api/test_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,7 @@ def test_functions_should_have_params(Script):
assert c.get_signatures()


def test_hashlib_params(Script, environment):
if environment.version_info < (3,):
pytest.skip()

def test_hashlib_params(Script):
script = Script('from hashlib import sha256')
c, = script.complete()
sig, = c.get_signatures()
Expand Down
7 changes: 0 additions & 7 deletions test/test_inference/test_fstring.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import pytest
from textwrap import dedent


@pytest.fixture(autouse=True)
def skip_not_supported(environment):
if environment.version_info < (3, 6):
pytest.skip()


def test_fstring_multiline(Script):
code = dedent("""\
'' f'''s{
Expand Down
12 changes: 3 additions & 9 deletions test/test_inference/test_literals.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,23 @@ def _infer_literal(Script, code, is_fstring=False):
return def_._name._value.get_safe_value()


def test_f_strings(Script, environment):
def test_f_strings(Script):
"""
f literals are not really supported in Jedi. They just get ignored and an
empty string is returned.
"""
if environment.version_info < (3, 6):
pytest.skip()

assert _infer_literal(Script, 'f"asdf"', is_fstring=True) == ''
assert _infer_literal(Script, 'f"{asdf} "', is_fstring=True) == ''
assert _infer_literal(Script, 'F"{asdf} "', is_fstring=True) == ''
assert _infer_literal(Script, 'rF"{asdf} "', is_fstring=True) == ''


def test_rb_strings(Script, environment):
def test_rb_strings(Script):
assert _infer_literal(Script, 'x = br"asdf"; x') == b'asdf'
assert _infer_literal(Script, 'x = rb"asdf"; x') == b'asdf'


def test_thousand_separators(Script, environment):
if environment.version_info < (3, 6):
pytest.skip()

def test_thousand_separators(Script):
assert _infer_literal(Script, '1_2_3') == 123
assert _infer_literal(Script, '123_456_789') == 123456789
assert _infer_literal(Script, '0x3_4') == 52
Expand Down
6 changes: 1 addition & 5 deletions test/test_inference/test_signature.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from textwrap import dedent
from operator import ge, lt
from operator import ge
import re
import os

Expand All @@ -17,14 +17,10 @@
('str', "str(object='', /) -> str", ['object'], ge, (3, 6)),
('pow', 'pow(x, y, z=None, /) -> number', ['x', 'y', 'z'], lt, (3, 6)),
('pow', 'pow(base, exp, mod=None)', ['base', 'exp', 'mod'], ge, (3, 8)),
('bytes.partition', 'partition(self, sep, /) -> (head, sep, tail)',
['self', 'sep'], lt, (3, 6)),
('bytes.partition', 'partition(self, sep, /)', ['self', 'sep'], ge, (3, 6)),
('bytes().partition', 'partition(sep, /) -> (head, sep, tail)', ['sep'], lt, (3, 6)),
('bytes().partition', 'partition(sep, /)', ['sep'], ge, (3, 6)),
]
)
Expand Down

0 comments on commit b017288

Please sign in to comment.