# test.tech-mail.ru

Mar 3rd, 2021
862
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import pytest
2.
3.
4. def inc(x):
5.     return x + 1
6.
7.
8. def test_str_1():
9.     # Check length of string for even
10.     str = "By"
11.     assert len(str) % 2 == 0, "length of string is odd"
12.
13.
14. def test_str_2():
15.     # Check length of string for odd
16.     str = "Hello"
17.     assert len(str) % 2 != 0, "length of string is even"
18.
19.
20. def test_str_3(param):
21.     # Check length of string for whole division by param
22.     str = "Hello"
23.     try:
24.         assert len(str) % param == 0, f"length of string is not divided by {param} whole"
25.     except ZeroDivisionError:
26.         pass
27.
28.
29. def test_set_1():
30.     # Check length of set for even
31.     set = {0, 1, 2, 3}
32.     assert len(set) % 2 == 0, "length of set is odd"
33.
34.
35. def test_set_2():
36.     # Check length of set for odd
37.     set = {0, 1, 2, 3, 4}
38.     assert len(set) % 2 != 0, "length of set is even"
39.
40.
41. def test_set_3(param):
42.     # Check length of set for whole division by param
43.     set = {0, 1, 2, 3, 4, 5}
44.     try:
45.         assert len(set) % param == 0, f"length of string is not divided by {param} whole"
46.     except ZeroDivisionError:
47.         pass
48.
49.
50. test_str_1()
51. test_str_2()
52. test_str_3(0)
53. test_set_1()
54. test_set_2()
55. test_set_3(0)
56.
RAW Paste Data