Exemplo n.º 1
0
 def test_simple(self):
     dot = Dot('foo')
     self.assertEqual(dot._apply_item(self.data), 'bar')
Exemplo n.º 2
0
 def test_not_an_object(self):
     dot = Dot('bah')
     with self.assertRaises(MatchError) as cm:
         dot._apply_item([1,2,3])
     self.assertEqual(cm.exception.error, 'tried to access field .bah on a non-object')
Exemplo n.º 3
0
 def test_no_such_key(self):
     dot = Dot('gah')
     self.assertIsNone(dot._apply_item({'bar': 3}))
Exemplo n.º 4
0
 def test_simple(self):
     dot = Dot('foo')
     self.assertEqual(dot._apply_item(self.data), 'bar')
Exemplo n.º 5
0
 def test_not_an_object(self):
     dot = Dot('bah')
     with self.assertRaises(MatchError) as cm:
         dot._apply_item([1, 2, 3])
     self.assertEqual(cm.exception.error,
                      'tried to access field .bah on a non-object')
Exemplo n.º 6
0
 def test_no_such_key(self):
     dot = Dot('gah')
     self.assertIsNone(dot._apply_item({'bar': 3}))