mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
Perform real shortcut processing as in production environment. Must not be called in WA due to that. GitOrigin-RevId: faa0302c4cd7460f08792e6170ae027cbd415de4
55 lines
1.3 KiB
Plaintext
55 lines
1.3 KiB
Plaintext
import pytest
|
|
|
|
|
|
@pytest.mark.parametrize("test_input,expected", [
|
|
("3+5", 8),
|
|
("2+4", 6),
|
|
])
|
|
@pytest.mark.parametrize("x", [0, 1])
|
|
@pytest.mark.parametrize("y", [2, 3])
|
|
def test_returns_correct_result(test_input, expected, x, y): # False positive: unused parameters
|
|
y.bit_length() #
|
|
x.bit_length() #
|
|
test_input.__len__() #
|
|
expected.bit_length() #
|
|
|
|
@pytest.mark.parametrize(('x', 'y'), [(1, 2, 3, 4)]) # Too many values in tuple, should be 2
|
|
def test_wrong_number_of_parameters(x, y):
|
|
x.bit_length() #
|
|
|
|
@pytest.mark.parametrize("y", ['2', 3])
|
|
def test_foo(y):
|
|
y.bit_length() #
|
|
y.__xor__()#
|
|
|
|
@pytest.mark.parametrize("y", 3)
|
|
def test_int_foo(y):
|
|
y.__xor__()#
|
|
|
|
|
|
@pytest.mark.parametrize
|
|
|
|
|
|
@pytest.fixture()
|
|
def my_spam_fix(request) -> str:
|
|
return 'x' * request.param
|
|
|
|
|
|
@pytest.mark.parametrize('my_spam_fix', (1, 2, 3), indirect=True)
|
|
def test_indirect(my_spam_fix):
|
|
assert my_spam_fix.find()#
|
|
|
|
|
|
@pytest.mark.parametrize('my_spam_fix', (1, 2, 3))
|
|
def test_no_indirect(my_spam_fix):
|
|
assert my_spam_fix.__xor__()#
|
|
|
|
|
|
@pytest.fixture()
|
|
def my_eggs_fixture(request) -> str:
|
|
return 'x' * request.param
|
|
|
|
@pytest.mark.parametrize('my_spam_fix, my_eggs_fixture', (1, 2), indirect=["my_spam_fix"])
|
|
def test_indirect_two(my_spam_fix, my_eggs_fixture):
|
|
assert my_spam_fix.find()#
|
|
assert my_eggs_fixture.__xor__()# |