Esempio n. 1
0
 def test_dict_with_mask(self):
     dct = self.conf['dict_with_mask']
     self.assertEqual(self.conf.get_dict_value(self.conf['dict_with_mask'], 'a'), 4)
     self.assertEqual(get_dict_value(self.conf['dict_with_mask'], 'a'), 4)
     self.assertEqual(self.conf.get_dict_value(self.conf['dict_with_mask'], 'c'), 3)
     self.assertEqual(self.conf.get_dict_value(self.conf['dict_with_mask'], 'a1'), 0)
     self.assertEqual(self.conf.get_dict_value(self.conf['dict_with_mask'], 'a22'), 0)
     self.assertEqual(self.conf.get_dict_value(self.conf['dict_with_mask'], 'b'), 5)
     self.assertRaises(KeyError, self.conf.get_dict_value, self.conf['dict_with_mask'], 'b1') # two masks corresponds
     self.assertEqual(self.conf.get_dict_value(self.conf['dict_with_mask'], 'b12'), 1)
Esempio n. 2
0
 def test_dict_with_mask(self):
     dct = self.conf['dict_with_mask']
     self.assertEqual(self.conf.get_dict_value(self.conf['dict_with_mask'], 'a'), 4)
     self.assertEqual(get_dict_value(self.conf['dict_with_mask'], 'a'), 4)
     self.assertEqual(self.conf.get_dict_value(self.conf['dict_with_mask'], 'c'), 3)
     self.assertEqual(self.conf.get_dict_value(self.conf['dict_with_mask'], 'a1'), 0)
     self.assertEqual(self.conf.get_dict_value(self.conf['dict_with_mask'], 'a22'), 0)
     self.assertEqual(self.conf.get_dict_value(self.conf['dict_with_mask'], 'b'), 5)
     self.assertRaises(KeyError, self.conf.get_dict_value, self.conf['dict_with_mask'], 'b1') # two masks corresponds
     self.assertEqual(self.conf.get_dict_value(self.conf['dict_with_mask'], 'b12'), 1)
Esempio n. 3
0
 def test_dict_with_default(self):
     self.assertEqual(
         self.conf.get_dict_value(self.conf["dict_with_default"], "a"), 1)
     self.assertEqual(get_dict_value(self.conf["dict_with_default"], "b"),
                      2)
     self.assertEqual(
         self.conf.get_dict_value(self.conf["dict_with_default"], "c"), 0)
     self.assertRaises(TypeError, self.conf.get_dict_value,
                       self.conf["string1"], "a")
     self.assertRaises(KeyError, self.conf.get_dict_value,
                       self.conf["dict"], "not_found")
Esempio n. 4
0
 def test_dict_with_default(self):
     self.assertEqual(self.conf.get_dict_value(self.conf["dict_with_default"], "a"), 1)
     self.assertEqual(get_dict_value(self.conf["dict_with_default"], "b"), 2)
     self.assertEqual(self.conf.get_dict_value(self.conf["dict_with_default"], "c"), 0)
     self.assertRaises(TypeError, self.conf.get_dict_value, self.conf["string1"], "a")
     self.assertRaises(KeyError, self.conf.get_dict_value, self.conf["dict"], "not_found")