Example #1
0
def test_empty_array():
    array = []
    assert get_majority_item(array) is None
Example #2
0
def test_dc_no_majority_array():
    array = [1, 2, 1, 2, 1, 2, 3]
    majority_item = get_majority_item(array, 'dc')
    assert majority_item is None
Example #3
0
def test_dc_one_element_array():
    array = [1]
    majority_item = get_majority_item(array, 'dc')
    assert majority_item is 1
Example #4
0
def test_dc_majority_array():
    array = [1, 2, 1, 2, 1, 2, 2]
    majority_item = get_majority_item(array, 'dc')
    assert majority_item is 2
    assert majority_item is not 1
Example #5
0
def test_no_array():
    array = None
    assert get_majority_item(array) is None