Example #1
0
def test_text_field_split_keys(split_keys, test_data, result):
    item_data = Text(split_keys=split_keys)
    assert item_data.parse(test_data) == result
Example #2
0
def test_text_field_separator_default(test_data, result):
    item_data = Text()
    assert item_data.parse(test_data) == result
Example #3
0
def test_text_replace_keys():
    test_text = "Easybook Pro 15"

    item_data = Text(replace_keys=[("pro", "Air"), ("15", "13")])
    assert item_data.parse(test_text) == "Easybook Air 13"
Example #4
0
def test_text_split_key(split_key, test_data, result):
    item_data = Text(split_key=split_key)
    assert item_data.parse(test_data) == result
Example #5
0
def test_text_normalize_default(test_data, result):
    assert Text().parse(test_data) == result
Example #6
0
def test_text_normalize_false():
    text_parser = Text(normalize=False)

    expected_text = "Easybook Pro 13 <3 ünicode"
    assert text_parser.parse(
        "Easybook Pro 13 <3 ünicode") == expected_text
Example #7
0
def test_text_parser_title():
    text_parser = Text(title=True)
    assert text_parser.parse("Easybook Pro 13") == "Easybook Pro 13"
Example #8
0
def test_text_parser_empty_data(test_data, result):
    text_parser = Text()
    assert text_parser.parse(test_data) is result
Example #9
0
def test_text_parser_uppercase():
    text_parser = Text(uppercase=True)
    assert text_parser.parse("Easybook Pro 13") == "EASYBOOK PRO 13"
Example #10
0
def test_text_parser_lowercase():
    text_parser = Text(lowercase=True)
    assert text_parser.parse("Easybook Pro 13") == "easybook pro 13"
Example #11
0
def test_text_skip(skip, test_data, result):
    text_parser = Text(skip=skip)
    assert text_parser.parse(test_data) == result
Example #12
0
def test_text_take(take, test_data, result):
    text_parser = Text(take=take)
    assert text_parser.parse(test_data) == result
Example #13
0
def test_text_parser_default(default, test_data, result):
    text_parser = Text(default=default)
    assert text_parser.parse(test_data) == result
Example #14
0
def test_text_field_separator_custom(separator, test_data, result):
    item_data = Text(separator=separator)
    assert item_data.parse(test_data) == result
Example #15
0
def test_text_parser_capitalize():
    text_parser = Text(capitalize=True)
    assert text_parser.parse("Easybook pro 13") == "Easybook pro 13"
Example #16
0
def test_text_field_index(index, test_data, result):
    item_data = Text(index=index)
    assert item_data.parse(test_data) == result
Example #17
0
def test_text_parser(test_data, result):
    assert Text().parse(test_data) == result