Skip to content

Commit 44b040d

Browse files
committed
test: fix typechecks and unit tests
1 parent 9741906 commit 44b040d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

slack_sdk/models/blocks/basic_components.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ def value_length(self) -> bool:
573573

574574
def to_dict(self) -> Dict[str, Any]:
575575
self.validate_json()
576-
json = {}
576+
json: Dict[str, Union[str, dict]] = {}
577577
if self._text:
578578
json["text"] = self._text.to_dict()
579579
if self._accessibility_label:

tests/slack_sdk/models/test_objects.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,13 @@ def test_deny_length(self):
365365
class FeedbackButtonObjectTests(unittest.TestCase):
366366
def test_basic_json(self):
367367
feedback_button = FeedbackButtonObject(text="+1", value="positive")
368-
expected = {"text": PlainTextObject(text="+1"), "value": "positive"}
368+
expected = {"text": {"emoji": True, "text": "+1", "type": "plain_text"}, "value": "positive"}
369369
self.assertDictEqual(expected, feedback_button.to_dict())
370370

371371
def test_with_accessibility_label(self):
372372
feedback_button = FeedbackButtonObject(text="+1", value="positive", accessibility_label="Positive feedback button")
373373
expected = {
374-
"text": PlainTextObject(text="+1"),
374+
"text": {"emoji": True, "text": "+1", "type": "plain_text"},
375375
"value": "positive",
376376
"accessibility_label": "Positive feedback button",
377377
}
@@ -381,7 +381,7 @@ def test_with_plain_text_object(self):
381381
text_obj = PlainTextObject(text="-1", emoji=False)
382382
feedback_button = FeedbackButtonObject(text=text_obj, value="negative")
383383
expected = {
384-
"text": PlainTextObject(text="-1"),
384+
"text": {"emoji": False, "text": "-1", "type": "plain_text"},
385385
"value": "negative",
386386
}
387387
self.assertDictEqual(expected, feedback_button.to_dict())
@@ -399,7 +399,7 @@ def test_parse_from_dict(self):
399399
parsed = FeedbackButtonObject.parse(data)
400400
self.assertIsInstance(parsed, FeedbackButtonObject)
401401
expected = {
402-
"text": PlainTextObject(text="+1"),
402+
"text": {"emoji": True, "text": "+1", "type": "plain_text"},
403403
"value": "positive",
404404
"accessibility_label": "Positive feedback",
405405
}

0 commit comments

Comments
 (0)