예제 #1
0
def test_mops_instantiation():
    mops_set = Mops(create_argv(test_command_9))
    assert len(mops_set) == 4
    assert ("m" in mops_set) == True
    assert ("o" in mops_set) == True
    assert ("p" in mops_set) == True
    assert ("s" in mops_set) == True
    assert ("z" in mops_set) == False
예제 #2
0
def test_mops_contains():
    mops_set = Mops(create_argv(test_command_9))
    assert len(mops_set) == 4
    assert mops_set.contains(("m")) == True
    assert mops_set.contains(("m", "o")) == True
    assert mops_set.contains(("m", "o", "p")) == True
    assert mops_set.contains(("m", "o", "p", "s")) == True
    assert mops_set.contains(("b")) == False       # switch character that is not present should yield False
    assert mops_set.contains(("m", "b")) == False  # single missing switch character should yield False
예제 #3
0
def test_mops_contains():
    mops_set = Mops(create_argv(test_command_9))
    assert len(mops_set) == 4
    assert mops_set.contains(("m")) == True
    assert mops_set.contains(("m", "o")) == True
    assert mops_set.contains(("m", "o", "p")) == True
    assert mops_set.contains(("m", "o", "p", "s")) == True
    assert mops_set.contains(
        ("b"
         )) == False  # switch character that is not present should yield False
    assert mops_set.contains(
        ("m",
         "b")) == False  # single missing switch character should yield False
예제 #4
0
def test_mops_instantiation_multiple_mops_in_command():
    mops_set = Mops(create_argv(test_command_11))
    assert len(
        mops_set
    ) == 6  # set data type should eliminate multiple requested switches that are the same
    assert ("m" in mops_set) == True
    assert ("o" in mops_set) == True
    assert ("p" in mops_set) == True
    assert ("s" in mops_set) == True
    assert ("t" in mops_set) == True
    assert ("e" in mops_set) == True
    assert ("z" in mops_set) == False
예제 #5
0
def test_mops_str_method_empty():
    mops_set = Mops(create_argv(test_command_2))
    assert len(mops_set) == 0
    assert mops_set.__str__() == """{}""" or mops_set.__repr__() == """{}"""
예제 #6
0
def test_mops_str_method():
    mops_set = Mops(create_argv(test_command_12))
    assert len(mops_set) == 2
    assert mops_set.__str__() == """{'m', 'o'}""" or mops_set.__repr__(
    ) == """{'o', 'm'}"""
예제 #7
0
def test_mops_str_method_empty():
    mops_set = Mops(create_argv(test_command_2))
    assert len(mops_set) == 0
    assert mops_set.__str__() == """{}""" or mops_set.__repr__() == """{}"""
예제 #8
0
def test_mops_str_method():
    mops_set = Mops(create_argv(test_command_12))
    assert len(mops_set) == 2
    assert mops_set.__str__() == """{'m', 'o'}""" or mops_set.__repr__() == """{'o', 'm'}"""