(self)
| 7 | |
| 8 | class TestErrors(TestCase): |
| 9 | def test_string_keys_error(self): |
| 10 | data = [{'a': 'A', 'b': (2, 4), 'c': 3.0, ('d',): 'D tuple'}] |
| 11 | try: |
| 12 | json.dumps(data) |
| 13 | except TypeError: |
| 14 | err = sys.exc_info()[1] |
| 15 | else: |
| 16 | self.fail('Expected TypeError') |
| 17 | self.assertEqual(str(err), |
| 18 | 'keys must be str, int, float, bool or None, not tuple') |
| 19 | |
| 20 | def test_not_serializable(self): |
| 21 | try: |