示例#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")]