コード例 #1
0
def test_duplicate_lowercase():
    assert count_char("aaabbbcccdddeee") == {
        "a": 3,
        "b": 3,
        "c": 3,
        "d": 3,
        "e": 3
    }
コード例 #2
0
def test_uppercase_lowercase():
    assert count_char("AaaBbBCCcDdEEE") == {
        "A": 1,
        "a": 2,
        "B": 2,
        "b": 1,
        "C": 2,
        "c": 1,
        "D": 1,
        "d": 1,
        "E": 3
    }
コード例 #3
0
def test_many_letters():
    assert count_char("abcdefghij") == {
        "a": 1,
        "b": 1,
        "c": 1,
        "d": 1,
        "e": 1,
        "f": 1,
        "g": 1,
        "h": 1,
        "i": 1,
        "j": 1
    }
コード例 #4
0
def test_sentence():
    assert count_char("I am 5 years old!?") == {
        "I": 1,
        " ": 4,
        "a": 2,
        "m": 1,
        "5": 1,
        "y": 1,
        "e": 1,
        "r": 1,
        "s": 1,
        "o": 1,
        "l": 1,
        "d": 1,
        "!": 1,
        "?": 1
    }
コード例 #5
0
ファイル: test_count.py プロジェクト: mlangTse/comp1531
def test_empty():
    assert count_char("") == {}
コード例 #6
0
def test_numbers():
    assert count_char("12342") == {"1":1, "2":2, "3":1, "4":1}
コード例 #7
0
def test_space():
    assert count_char("Hi there") == {"H":1, "i":1, " ":1, "t":1, "h":1, "e":2, "r":1}
コード例 #8
0
def test_special():
    assert count_char("!@#$%^^") == {"!":1, "@":1, "#":1, "$":1, "%":1, "^":2}
コード例 #9
0
def test_space():
    assert count_char("h i") == {"h": 1, " ": 1, "i": 1}
コード例 #10
0
ファイル: test_count.py プロジェクト: MarcRocca6/COMP1531
def test_triple():
    assert count_char("aaabbb") == {"a": 3, "b": 3}
    assert count_char("$$$###") == {"$": 3, "#": 3}
    assert count_char("oooOO!!!") == {"o": 3, "O": 2, "!": 3}
コード例 #11
0
def test_number():
    assert count_char("2021") == {"2": 2, "0": 1, "1": 1}
コード例 #12
0
def test_symbol():
    assert count_char("a!?!") == {"a": 1, "!": 2, "?": 1}
コード例 #13
0
ファイル: test_count.py プロジェクト: MarcRocca6/COMP1531
def test_simple():
    assert count_char("abc") == {"a": 1, "b": 1, "c": 1}
    assert count_char("123") == {"1": 1, "2": 1, "3": 1}
    assert count_char("khj") == {"k": 1, "h": 1, "j": 1}
    assert count_char("#^@") == {"#": 1, "^": 1, "@": 1}
コード例 #14
0
ファイル: test_count.py プロジェクト: MarcRocca6/COMP1531
def test_random():
    assert count_char("BBBb  ") == {"B": 3, "b": 1, " ": 2}
    assert count_char("YeEEYeEl@@YYeee") == {"Y": 4, "e": 5, "E": 3, "l": 1, "@": 2}

    
コード例 #15
0
ファイル: test_count.py プロジェクト: mlangTse/comp1531
def test_simple():
    assert count_char("abc") == {"a": 1, "b": 1, "c": 1}
コード例 #16
0
def test_symbols():
    assert count_char("!@#$%") == {"!": 1, "@": 1, "#": 1, "$": 1, "%": 1}
コード例 #17
0
ファイル: test_count.py プロジェクト: mlangTse/comp1531
def test_double():
    assert count_char("aa") == {"a": 2}
コード例 #18
0
ファイル: test_count.py プロジェクト: MarcRocca6/COMP1531
def test_double():
    assert count_char("hh") == {"h": 2}
    assert count_char("aa") == {"a": 2}
    assert count_char("@@") == {"@": 2}
    assert count_char("99") == {"9": 2}