Esempio n. 1
0
def test_get_info():
    mapping = {"name": ".test1", "value": ".asdfg"}
    default = None
    output = u.get_info(basic_soup, mapping)
    expected_output = {}
    for key, selector in mapping.items():
        expected_output[key] = u.text_or_default(basic_soup, selector, default=default)
    assert output == expected_output
Esempio n. 2
0
def test_text_or_default():
    assert u.text_or_default(basic_soup, ".asdf") == None
    assert u.text_or_default(basic_soup, ".a1") == "Test"
    assert u.text_or_default(basic_soup, ".test1") == "Test"
Esempio n. 3
0
def test_text_or_default():
    assert u.text_or_default(basic_soup, '.asdf') == None
    assert u.text_or_default(basic_soup, '.1') == 'Test'