def test_numeric_values(): # numeric values are allowed custom_data = CustomData() custom_data['a'] = 1 custom_data['b'] = 3.14 custom_data['c'] = 0177 custom_data['d'] = 0x7F
def test_list_value(): # list values are not allowed custom_data = CustomData() custom_data['a'] = ['b', 'c']
def test_dict_value(): # dict values are not allowed custom_data = CustomData() custom_data['a'] = {'b': 'c'}
def test_complex_number_values(): # complex numeber values are allowed custom_data = CustomData() custom_data['a'] = complex(1.0, 0.2)
def test_numeric_key(): # numeric keys are not allowed custom_data = CustomData() custom_data[1] = 'a'
def test_dict_key(): # dict keys are not allowed custom_data = CustomData() custom_data[{'a': 'b'}] = 'c'
def test_string_key(): # string keys are allowed custom_data = CustomData() custom_data['a'] = 'b'
def test_init_dict_arg(): # dict arg __init__ custom_data = CustomData({'color': 'red'}) eq_(1, len(custom_data))
def test_init_no_arg(): # no arg __init__ custom_data = CustomData() eq_(0, len(custom_data))
def test_init_dict_arg(self): # dict arg __init__ custom_data = CustomData({'color': 'red'}) self.assertEqual(1, len(custom_data))
def test_init_no_arg(self): # no arg __init__ custom_data = CustomData() self.assertEqual(0, len(custom_data))