示例#1
0
 def test_single_level_present(self):
     a = {'john': 'ford'}
     self.assertEqual(subject.lookup('john', a), 'ford')
示例#2
0
 def test_multi_level_bad_intermediate_key(self):
     a = {'john': 69}
     with self.assertRaises(KeyError):
         subject.lookup('john.harrison.ford', a)
示例#3
0
 def test_multi_level_partial_key(self):
     a = {'john': {'steven'}}
     with self.assertRaises(KeyError):
         subject.lookup('john.harrison.ford', a)
示例#4
0
 def test_multi_level_absent(self):
     a = {}
     with self.assertRaises(KeyError):
         subject.lookup('john.harrison.ford', a)
示例#5
0
 def test_multi_level_present(self):
     a = {'john': {'harrison': {'ford': 69}}}
     self.assertEqual(subject.lookup('john.harrison.ford', a), 69)
示例#6
0
 def test_single_level_absent(self):
     a = {}
     with self.assertRaises(KeyError):
         subject.lookup('john', a)