Пример #1
0
def get_options(tree):
    xpath = (".//div[contains(@class, "
             "'freebirdThemedSelectOptionDarkerDisabled')]//content")

    # Ignore the first element, it is the "unselected" option
    option_elements = tree.xpath(xpath)[1:]

    return utils.eval_map(lambda x: x.text, option_elements)
Пример #2
0
def get_questions(tree):
    xpath = ".//div[@class='freebirdFormviewerViewNumberedItemContainer']"
    elements = tree.xpath(xpath)

    return utils.eval_map(create_question, elements)
Пример #3
0
 def test_eval_map_as_list(self):
     assert eval_map(lambda x: x*2, range(3), as_tuple=False) == [0, 2, 4]
Пример #4
0
 def test_eval_map_as_tuple(self):
     assert eval_map(lambda x: x, range(3), as_tuple=True) == (0, 1, 2)
Пример #5
0
 def test_eval_map_default_as_list(self):
     assert eval_map(lambda x: x*3, range(3)) == [0, 3, 6]