Пример #1
0
 def test_single_field_descend_non_dict(self):
     """Test that we can handle non-dicts."""
     formatter = SingleFieldDescend('name', StringFormatter())
     self.assertEqual('1', formatter.format(1))
Пример #2
0
 def test_single_field_descend_missing_key(self):
     """Test that we can descend a dict when the key is missing."""
     formatter = SingleFieldDescend('name', NoopFormatter())
     self.assertEqual(None, formatter.format({'b': 'c'}))
Пример #3
0
 def test_single_field_descend(self):
     """Test that we can descend a single field in a dict."""
     formatter = SingleFieldDescend('name', NoopFormatter())
     self.assertEqual("aa", formatter.format({'name': 'aa', 'b': 'c'}))
Пример #4
0
 def test_single_field_descend_non_dict(self):
     """Test that we can handle non-dicts."""
     formatter = SingleFieldDescend('name', StringFormatter())
     self.assertEqual('1', formatter.format(1))
Пример #5
0
 def test_single_field_descend_missing_key(self):
     """Test that we can descend a dict when the key is missing."""
     formatter = SingleFieldDescend('name', NoopFormatter())
     self.assertEqual(None, formatter.format({'b': 'c'}))
Пример #6
0
 def test_single_field_descend(self):
     """Test that we can descend a single field in a dict."""
     formatter = SingleFieldDescend('name', NoopFormatter())
     self.assertEqual("aa", formatter.format({'name': 'aa', 'b': 'c'}))