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