Ejemplo n.º 1
0
def test_positive_case1():
    """checking for Example 1 in the task"""
    assert major_and_minor_elem([3, 2, 3]) == (3, 2)
Ejemplo n.º 2
0
def test_negative_case1():
    """check if list of equal elements will give equal elements in output"""
    assert (not major_and_minor_elem([1, 1, 1, 1])[0] != major_and_minor_elem(
        [1, 1, 1, 1])[1])
Ejemplo n.º 3
0
def test_negative_case2():
    """check if list of 1 element passed will return a tuple with two that elements"""
    assert not major_and_minor_elem(["f"])[0] != major_and_minor_elem(["f"])[1]
Ejemplo n.º 4
0
def test_positive_case3():
    """checking for'-' output for most common element, that appears less then n // 2 times"""
    assert major_and_minor_elem([1, 2, 2, 3, 3, 4, 4, 5, 5, 5]) == ("-", 1)
Ejemplo n.º 5
0
def test_positive_case2():
    """checking for Example 2 in the task"""
    assert major_and_minor_elem([2, 2, 1, 1, 1, 2, 2]) == (2, 1)
Ejemplo n.º 6
0
def test_major_and_minor_elem(inp: List, expected_result: Tuple[int, int]):

    actual_result = hw2.major_and_minor_elem(inp)

    assert actual_result == expected_result
Ejemplo n.º 7
0
def test_major_and_minor_elem_one_elem():
    assert major_and_minor_elem([3]) == (3, 3)
Ejemplo n.º 8
0
def test_major_and_minor_elem_many_elem():
    assert major_and_minor_elem([2, 2, 1, 1, 1, 2, 2]) == (2, 1)