Skip to content

Commit 639dc9a

Browse files
authored
Add RichTextBlock to Block.parse() targets (#1433)
1 parent 06e55d1 commit 639dc9a

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

slack_sdk/models/blocks/blocks.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ def parse(cls, block: Union[dict, "Block"]) -> Optional["Block"]:
8989
return HeaderBlock(**block)
9090
elif type == VideoBlock.type:
9191
return VideoBlock(**block)
92+
elif type == RichTextBlock.type:
93+
return RichTextBlock(**block)
9294
else:
9395
cls.logger.warning(f"Unknown block detected and skipped ({block})")
9496
return None

tests/slack_sdk/models/test_blocks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,7 @@ def test_complex(self):
973973
],
974974
}
975975
self.assertDictEqual(dict_block, RichTextBlock(**dict_block).to_dict())
976+
self.assertDictEqual(dict_block, Block.parse(dict_block).to_dict())
976977

977978
_ = RichTextElementParts
978979
class_block = RichTextBlock(

0 commit comments

Comments
 (0)