def test_negative_limit(self): tag = Flag('type', 'asdf', '1234', limit=-1) tag.validate(strict=True) assert tag.valid
def test_under_limit(self): tag = Flag('type', 'asdf', '1234', limit=5) tag.validate(strict=True) assert tag.valid
def test_limit_exceeded(self): tag = Flag('type', 'asdf', '1234', limit=1) tag.validate(strict=True) assert not tag.valid
def test_hidden_values_must_exist(self): tag = Flag('type', 'value1') tag.hide_value('value2') tag.validate() assert not tag.valid assert "Value 'value2' for tag 'type' cannot be hidden, because it does not exist" in tag.problems
def test_limit_zero_and_required_are_fine(self): tag = Flag('type', 'asdf', required=True, limit=0) tag.validate() assert tag.valid
def test_required_with_values_passes(self): tag = Flag('type', 'asdf', required=True) tag.validate() assert tag.valid