Example #1
0
def test_quote_whitespaces_empty_result():
    """Test the quote_whitespaces() function with no results."""
    data = []
    headers = ['h1', 'h2']
    expected = ([], ['h1', 'h2'])

    assert expected == quote_whitespaces(data, headers)
Example #2
0
def test_quote_whitespaces_non_spaces():
    """Test the quote_whitespaces() function with non-spaces."""
    data = [["\tbefore", "after \r"], ["\n both  ", "none"]]
    headers = ['h1', 'h2']
    expected = ([["'\tbefore'", "'after \r'"], ["'\n both  '",
                                                "'none'"]], ['h1', 'h2'])

    assert expected == quote_whitespaces(data, headers)
Example #3
0
def test_quote_whitespaces_non_spaces():
    """Test the quote_whitespaces() function with non-spaces."""
    data = [["\tbefore", "after \r"], ["\n both  ", "none"]]
    headers = ["h1", "h2"]
    expected = ([["'\tbefore'", "'after \r'"], ["'\n both  '", "'none'"]], ["h1", "h2"])
    results = quote_whitespaces(data, headers)

    assert expected == (list(results[0]), results[1])
Example #4
0
def test_quote_whitespaces():
    """Test the quote_whitespaces() function."""
    data = [["  before", "after  "], ["  both  ", "none"]]
    headers = ['h1', 'h2']
    expected = ([["'  before'", "'after  '"], ["'  both  '",
                                               "'none'"]], ['h1', 'h2'])

    assert expected == quote_whitespaces(data, headers)
Example #5
0
def test_quote_whitespaces_empty_result():
    """Test the quote_whitespaces() function with no results."""
    data = []
    headers = ["h1", "h2"]
    expected = ([], ["h1", "h2"])
    results = quote_whitespaces(data, headers)

    assert expected == (list(results[0]), results[1])