コード例 #1
0
def test_init():
    """Test __init__."""
    b = Bag('abracadabra')
    assert b.count('a') == 5
    assert b.count('b') == 2
    assert b.count('r') == 2
    assert b.count('c') == 1
    assert b.count('d') == 1
    b2 = bag(b)
    assert b2 == b
コード例 #2
0
def test_count():
    """Test count."""
    ms = Bag('abracadabra')
    assert ms.count('a') == 5
    assert ms.count('x') == 0