def test_lchop_unmatched():
    assert util.lchop("12345", "345") == "12345"
Example #2
0
 def optionxform(self, key):
     return lchop(key, "POWER_SUPPLY_")
def test_lchop_prefixed():
    assert util.lchop("12345", "12") == "345"
def test_lchop_no_prefix():
    assert util.lchop("345", "") == "345"
Example #5
0
 def optionxform(self, key):
     return lchop(key, "POWER_SUPPLY_")
def test_lchop_unmatched():
    assert util.lchop("12345", "345") == "12345"
def test_lchop_no_prefix():
    assert util.lchop("345", "") == "345"
def test_lchop_prefixed():
    assert util.lchop("12345", "12") == "345"
Example #9
0
def lchop(prefix, string):
    chopped = util.lchop(string, prefix)
    if string.startswith(prefix):
        assert len(chopped) == len(string) - len(prefix)
    assert not (prefix and chopped.startswith(prefix))