Ejemplo n.º 1
0
def test_escape_if_necessary_escapes_1_char():
    "strings.escape_if_necessary escapes regex if has only one char"
    assert_equals(strings.escape_if_necessary("$"), "[$]")
    assert_equals(strings.escape_if_necessary("^"), "[^]")
    assert_equals(strings.escape_if_necessary("#"), "[#]")
    assert_equals(strings.escape_if_necessary("("), "[(]")
    assert_equals(strings.escape_if_necessary(")"), "[)]")
    assert_equals(strings.escape_if_necessary("{"), "[{]")
    assert_equals(strings.escape_if_necessary("}"), "[}]")
Ejemplo n.º 2
0
def test_escape_if_necessary_escapes_1_char():
    "strings.escape_if_necessary escapes regex if has only one char"
    assert_equals(strings.escape_if_necessary("$"), "[$]")
    assert_equals(strings.escape_if_necessary("^"), "[^]")
    assert_equals(strings.escape_if_necessary("#"), "[#]")
    assert_equals(strings.escape_if_necessary("("), "[(]")
    assert_equals(strings.escape_if_necessary(")"), "[)]")
    assert_equals(strings.escape_if_necessary("{"), "[{]")
    assert_equals(strings.escape_if_necessary("}"), "[}]")
Ejemplo n.º 3
0
def test_escape_if_necessary_escapes_nothing_if_has_more_than_1_char():
    "Escape if necessary does nothing if the string has more than 1 char"
    assert_equals(strings.escape_if_necessary("NOT ESCAPED"), "NOT ESCAPED")
Ejemplo n.º 4
0
def test_escape_if_necessary_escapes_nothing_if_has_more_than_1_char():
    "Escape if necessary does nothing if the string has more than 1 char"
    assert_equals(strings.escape_if_necessary("NOT ESCAPED"), "NOT ESCAPED")