def test_label_named(): # bug test labeller = (lambda x: x) n = named(a1=(lambda x: 'bar')) extract = label(labeller)(n) assert list(extract("foo")) == [("foo", "a1", "bar")]
def test_label(): labeller = (lambda x: x) extract = label(labeller)(extract_arg0) assert list(extract("foo")) == [("foo", "foo")]
from wex.extractor import label, named from wex.url import url from wex.etree import xpath, text attrs = named(name=xpath('//h1') | text, country=xpath('//dd[@id="country"]') | text, region=xpath('//dd[@id="region"]') | text) extract = label(url)(attrs)