Example #1
0
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")]
Example #2
0
def test_label():
    labeller  = (lambda x: x)
    extract = label(labeller)(extract_arg0)
    assert list(extract("foo")) == [("foo", "foo")]
Example #3
0
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")]
Example #4
0
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)
Example #5
0
def test_label():
    labeller = (lambda x: x)
    extract = label(labeller)(extract_arg0)
    assert list(extract("foo")) == [("foo", "foo")]