Beispiel #1
0
def test_nohtml(string, expected, expected_quoted):
    result = lang.nohtml(string)
    assert isinstance(result, str)
    assert isinstance(result, lang.NoHtml)
    assert result == expected

    quoted = lang.quote(result)
    assert isinstance(quoted, str)
    assert quoted == expected_quoted
Beispiel #2
0
def test_nohtml_invalid(py2):
    match = r"required types.+'str'"
    if py2:
        match += r".+'unicode'"
    with pytest.raises(TypeError, match=match):
        nohtml(True)
Beispiel #3
0
def test_nohtml(string):
    result = nohtml(string)
    assert result == string
    assert isinstance(result, type(string))
Beispiel #4
0
def test_nohtml_invalid(py2):
    match = r"required types.+'str'"
    if py2:
        match += r".+'unicode'"
    with pytest.raises(TypeError, match=match):
        nohtml(True)
Beispiel #5
0
def test_nohtml(py2):
    assert nohtml('spam') == 'spam'
    assert isinstance(nohtml('spam'), str)
    assert nohtml(u'spam') == u'spam'
    assert isinstance(nohtml(u'spam'), unicode if py2 else str)
Beispiel #6
0
def test_nohtml(string='spam'):
    result = nohtml(string)
    assert result == string
    assert isinstance(result, str)