コード例 #1
0
    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)
コード例 #2
0
class CodesWithHiddenAttributes(BaseConstantsClass):
    foo = 4, attrs(label="Foo", visible=False)
    bar = 5, attrs(label="Bar", visible=True)
コード例 #3
0
class CodesWithAttributes(BaseConstantsClass):
    foo = 4, attrs(label="Foo")
    bar = 5, attrs(label="Bar")
    qux = 2, attrs(label="Quux")
コード例 #4
0
 class CustomData(BaseConstantsClass):
     foo = 4, attrs(data=u'foogroup')
     bar = 7, attrs(group=u'bg', css=u'blue')
コード例 #5
0
 class OptionalData(BaseConstantsClass):
     foo = 4, attrs(data=[1, 2, 3])
コード例 #6
0
 class OptionalCode(BaseConstantsClass):
     _ = None, attrs(visible=False)
     foo = 4, attrs(label="Foo")
コード例 #7
0
 class OptionalCode(BaseConstantsClass):
     _ = None, attrs(label='empty')
     foo = 4, attrs(label="Foo")