-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
48 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,3 @@ | ||
# This is a sample Python script. | ||
|
||
# Press Shift+F10 to execute it or replace it with your code. | ||
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. | ||
|
||
|
||
def print_hi(name): | ||
# Use a breakpoint in the code line below to debug your script. | ||
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. | ||
|
||
|
||
# Press the green button in the gutter to run the script. | ||
if __name__ == '__main__': | ||
print_hi('PyCharm') | ||
|
||
# See PyCharm help at https://www.jetbrains.com/help/pycharm/ | ||
print("Hello_World") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pytest | ||
|
||
|
||
def test_list_len(): | ||
list = [1, 2, 3, 4] | ||
assert len(list) == 4 | ||
|
||
|
||
@pytest.mark.parametrize("test_data, expected_result", [([0, 1, 2, 3, 4], [0, 1, 2, 3, 4]), # отсортированные положит числа | ||
([4, 3, 2, 1, 0], [0, 1, 2, 3, 4]), # неотсортированные положит числа | ||
([-4, -3, -2, -1, 0], [-4, -3, -2, -1, 0]), # отсортированные негатив числа | ||
([-3, -4, -1, -2, 0], [-4, -3, -2, -1, 0]), # неотсортированные негатив числа | ||
([-4, 5, 1, 1, 0], [-4, 0, 1, 1, 5])]) # неотсортированные негатив и позитив числа | ||
def test_list_sort(test_data, expected_result): | ||
list = test_data | ||
list.sort() | ||
assert list == expected_result | ||
|
||
def test_list_remove(): | ||
list = [1,2,3] | ||
try: | ||
assert list.remove(4) | ||
except ValueError: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import pytest | ||
|
||
|
||
def test_set_add_new_element(): | ||
a = {1, 2, 2, 3, 0} | ||
assert 3 in a | ||
|
||
|
||
@pytest.mark.parametrize("test_data1, test_data2, expected_result", [({1, 2, 2, 4}, {5, 6, 1, 0}, {1}), #входит один элемент | ||
({1, 2, 2, 4}, {5, 6, 6, 0}, set()), #ни один не входит | ||
({1, 2, 2, 3, 4}, {1, 2, 6, 7, 3}, {1, 2, 3}), #входят несколько элементов | ||
]) | ||
def test_set_intersection(test_data1, test_data2, expected_result): | ||
a = test_data1 | ||
b = test_data2 | ||
assert a.intersection(b) == expected_result | ||
|
||
|
||
def test_set_from_list(): | ||
try: | ||
assert set([[1, 2], [2, 3], [1, 2], [2, 5]]) | ||
except TypeError: | ||
pass |