Example #1
0
def test_format_safe_lstrip_control():
    """Test handling of non-printing control characters."""
    all_formatting = ''.join(formatting.CONTROL_FORMATTING)

    # no formatting chars should be stripped,
    # but a reset should be added to the end
    assert tell._format_safe_lstrip(all_formatting) == all_formatting

    # control characters not recognized as formatting should be stripped
    assert tell._format_safe_lstrip(''.join(
        c for c in formatting.CONTROL_NON_PRINTING
        if c not in formatting.CONTROL_FORMATTING)) == ''
Example #2
0
def test_format_safe_lstrip_pairs(text, cleaned):
    """Test expected formatting-safe string sanitization."""
    assert tell._format_safe_lstrip(text) == cleaned
Example #3
0
def test_format_safe_lstrip_invalid_arg():
    """Test for correct exception if non-string is passed."""
    with pytest.raises(TypeError):
        tell._format_safe_lstrip(None)
Example #4
0
def test_format_safe_lstrip_basic():
    """Test handling of basic whitespace."""
    assert tell._format_safe_lstrip(''.join(UNICODE_ZS_CATEGORY)) == ''