Example #1
0
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
Example #2
0
def test_list_value():
    # list values are not allowed
    custom_data = CustomData()
    custom_data['a'] = ['b', 'c']
Example #3
0
def test_dict_value():
    # dict values are not allowed
    custom_data = CustomData()
    custom_data['a'] = {'b': 'c'}
Example #4
0
def test_complex_number_values():
    # complex numeber values are allowed
    custom_data = CustomData()
    custom_data['a'] = complex(1.0, 0.2)
Example #5
0
def test_numeric_key():
    # numeric keys are not allowed
    custom_data = CustomData()
    custom_data[1] = 'a'
Example #6
0
def test_dict_key():
    # dict keys are not allowed
    custom_data = CustomData()
    custom_data[{'a': 'b'}] = 'c'
Example #7
0
def test_string_key():
    # string keys are allowed
    custom_data = CustomData()
    custom_data['a'] = 'b'
Example #8
0
def test_init_dict_arg():
    # dict arg __init__
    custom_data = CustomData({'color': 'red'})
    eq_(1, len(custom_data))
Example #9
0
def test_init_no_arg():
    # no arg __init__
    custom_data = CustomData()
    eq_(0, len(custom_data))
Example #10
0
 def test_init_dict_arg(self):
     # dict arg __init__
     custom_data = CustomData({'color': 'red'})
     self.assertEqual(1, len(custom_data))
Example #11
0
 def test_init_no_arg(self):
     # no arg __init__
     custom_data = CustomData()
     self.assertEqual(0, len(custom_data))