コード例 #1
0
def test_only_non_unique_elements():
    assert non_unique_elements([5, 5, 5, 5,
                                5]) == [5, 5, 5, 5,
                                        5], "Only non-unique elements"
コード例 #2
0
def test_only_unique_elements():
    assert non_unique_elements([1, 2, 3, 4, 5]) == [], "Only unique elements"
コード例 #3
0
def test_list_with_empty_strings():
    assert non_unique_elements(["", "", "",
                                "a"]) == ["", "",
                                          ""], "List with empty strings"
コード例 #4
0
def test_string():
    assert non_unique_elements("aaaagggrty") == [
        "a", "a", "a", "a", "g", "g", "g"
    ], "A string"
コード例 #5
0
def test_empty_string():
    assert non_unique_elements("") == [], "Empty string"
コード例 #6
0
def test_dictionary():
    assert non_unique_elements({
        "first": 1,
        "second": 1,
        "third": 3
    }) == [1, 1], "Dictionary"
コード例 #7
0
def test_empty_list():
    assert non_unique_elements([]) == [], "Empty list"
コード例 #8
0
def test_floats():
    assert non_unique_elements([1.1 + 2.2, 3.3]) == [], "Floats"
コード例 #9
0
def test_words():
    assert non_unique_elements(["hello", "hello",
                                "world"]) == ["hello", "hello"], "Words"
コード例 #10
0
def test_one_unique_element():
    assert non_unique_elements([10, 9, 10, 10, 9,
                                8]) == [10, 9, 10, 10, 9], "One unique element"