Пример #1
0
 def test_dict_of_strings(self):
     parser = waffle_config.DictOf(str)
     assert parser("dude:abides,walter:rages,donnie:bowls") == {
         "dude": "abides",
         "walter": "rages",
         "donnie": "bowls",
     }
Пример #2
0
 def test_dict_of_floats(self):
     parser = waffle_config.DictOf(float)
     assert parser("dude:1,walter:2,donnie:3.3") == {
         "dude": 1.0,
         "walter": 2.0,
         "donnie": 3.3,
     }
Пример #3
0
 def test_dict_of_whitespace(self):
     parser = waffle_config.DictOf(int)
     assert parser(" dude:1, walter: 2 , donnie : 3  ") == {
         "dude": 1,
         "walter": 2,
         "donnie": 3,
     }
Пример #4
0
 def test_dict_of_strings(self):
     parser = waffle_config.DictOf(str)
     assert parser('dude:abides,walter:rages,donnie:bowls') == {
         'dude': 'abides',
         'walter': 'rages',
         'donnie': 'bowls',
     }
Пример #5
0
 def test_dict_of_floats(self):
     parser = waffle_config.DictOf(float)
     assert parser('dude:1,walter:2,donnie:3.3') == {
         'dude': 1.0,
         'walter': 2.0,
         'donnie': 3.3,
     }
Пример #6
0
 def test_dict_of_whitespace(self):
     parser = waffle_config.DictOf(int)
     assert parser(' dude:1, walter: 2 , donnie : 3  ') == {
         'dude': 1,
         'walter': 2,
         'donnie': 3,
     }
Пример #7
0
 def test_empty(self):
     parser = waffle_config.DictOf(int)
     assert parser("") == {}
Пример #8
0
 def test_wrong_type(self):
     parser = waffle_config.DictOf(int)
     with self.assertRaises(ValueError):
         parser("dude:abides,walter:2,donnie:3")