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)
def get_questions(tree): xpath = ".//div[@class='freebirdFormviewerViewNumberedItemContainer']" elements = tree.xpath(xpath) return utils.eval_map(create_question, elements)
def test_eval_map_as_list(self): assert eval_map(lambda x: x*2, range(3), as_tuple=False) == [0, 2, 4]
def test_eval_map_as_tuple(self): assert eval_map(lambda x: x, range(3), as_tuple=True) == (0, 1, 2)
def test_eval_map_default_as_list(self): assert eval_map(lambda x: x*3, range(3)) == [0, 3, 6]