def test_is_not_found(self): arg = namedtuple("Param", "a b c") with pytest.raises(AttributeError): helpers.get_attribute_from_argvalue(arg(1, 2, 3), "d") arg = ('a', 'b', 'c') with pytest.raises(IndexError): helpers.get_attribute_from_argvalue(arg, 4)
def test_is_not_found_with_decorator(self): m = helpers.MarkDecorator("sanity") with pytest.raises(IndexError): helpers.get_attribute_from_argvalue(m, "a")
def test_unnamedtuple(self): arg = ('a', 'b', 'c') attr = helpers.get_attribute_from_argvalue(arg, 1) assert attr == 'b'
def test_is_namedtuple(self): arg = namedtuple("Param", "a b c") attr = helpers.get_attribute_from_argvalue(arg(1, 2, 3), "a") assert attr == 1
def test_unnamedtuple_is_decorator(self): arg = ('a', 'b', 'c') m = helpers.MarkDecorator("sanity", [arg]) attr = helpers.get_attribute_from_argvalue(m, 1) assert attr == 'b'
def test_namedtuple_is_decorator(self): arg = namedtuple("Param", "a b c") m = helpers.MarkDecorator("sanity", [arg(1, 2, 3)]) attr = helpers.get_attribute_from_argvalue(m, "a") assert attr == 1