Skip to content

Commit

Permalink
Add RichTextBlock to Block.parse() targets (#1433)
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch authored Nov 23, 2023
1 parent 06e55d1 commit 639dc9a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions slack_sdk/models/blocks/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def parse(cls, block: Union[dict, "Block"]) -> Optional["Block"]:
return HeaderBlock(**block)
elif type == VideoBlock.type:
return VideoBlock(**block)
elif type == RichTextBlock.type:
return RichTextBlock(**block)
else:
cls.logger.warning(f"Unknown block detected and skipped ({block})")
return None
Expand Down
1 change: 1 addition & 0 deletions tests/slack_sdk/models/test_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,7 @@ def test_complex(self):
],
}
self.assertDictEqual(dict_block, RichTextBlock(**dict_block).to_dict())
self.assertDictEqual(dict_block, Block.parse(dict_block).to_dict())

_ = RichTextElementParts
class_block = RichTextBlock(
Expand Down

0 comments on commit 639dc9a

Please sign in to comment.