def test_can_add_custom_data_with_arbitrary_attribute_names(self): data_as_list = attrs(data=[42, 21]) assert_equals([42, 21], data_as_list.data) kw_only = attrs(answer=42, question=21) assert_equals({'answer': 42, 'question': 21}, kw_only.data) data_as_dict = attrs(data={'answer': 42, 'question': 21}) assert_equals({'answer': 42, 'question': 21}, data_as_dict.data)
class CodesWithHiddenAttributes(BaseConstantsClass): foo = 4, attrs(label="Foo", visible=False) bar = 5, attrs(label="Bar", visible=True)
class CodesWithAttributes(BaseConstantsClass): foo = 4, attrs(label="Foo") bar = 5, attrs(label="Bar") qux = 2, attrs(label="Quux")
class CustomData(BaseConstantsClass): foo = 4, attrs(data=u'foogroup') bar = 7, attrs(group=u'bg', css=u'blue')
class OptionalData(BaseConstantsClass): foo = 4, attrs(data=[1, 2, 3])
class OptionalCode(BaseConstantsClass): _ = None, attrs(visible=False) foo = 4, attrs(label="Foo")
class OptionalCode(BaseConstantsClass): _ = None, attrs(label='empty') foo = 4, attrs(label="Foo")