| 48 | |
| 49 | class BlockTests(unittest.TestCase): |
| 50 | def test_parse(self): |
| 51 | input = { |
| 52 | "type": "section", |
| 53 | "text": { |
| 54 | "type": "mrkdwn", |
| 55 | "text": "A message *with some bold text* and _some italicized text_.", |
| 56 | }, |
| 57 | "unexpected_field": "test", |
| 58 | "unexpected_fields": [1, 2, 3], |
| 59 | "unexpected_object": {"something": "wrong"}, |
| 60 | } |
| 61 | block = Block.parse(input) |
| 62 | self.assertIsNotNone(block) |
| 63 | |
| 64 | self.assertDictEqual( |
| 65 | { |
| 66 | "type": "section", |
| 67 | "text": { |
| 68 | "type": "mrkdwn", |
| 69 | "text": "A message *with some bold text* and _some italicized text_.", |
| 70 | }, |
| 71 | }, |
| 72 | block.to_dict(), |
| 73 | ) |
| 74 | |
| 75 | def test_eq(self): |
| 76 | self.assertEqual(Block(), Block()) |