File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -387,7 +387,7 @@ def __init__(
387387
388388class HeaderBlock (Block ):
389389 type = "header"
390- text_max_length = 3000
390+ text_max_length = 150
391391
392392 @property
393393 def attributes (self ) -> Set [str ]:
@@ -411,3 +411,7 @@ def __init__(
411411 @JsonValidator ("text attribute must be specified" )
412412 def _validate_text_populated (self ):
413413 return self .text is not None
414+
415+ @JsonValidator (f"text attribute cannot exceed { text_max_length } characters" )
416+ def _validate_alt_text_length (self ):
417+ return self .text is None or len (self .text .text ) <= self .text_max_length
Original file line number Diff line number Diff line change @@ -713,3 +713,21 @@ def test_document(self):
713713 }
714714 self .assertDictEqual (input , HeaderBlock (** input ).to_dict ())
715715 self .assertDictEqual (input , Block .parse (input ).to_dict ())
716+
717+ def test_text_length_150 (self ):
718+ input = {
719+ "type" : "header" ,
720+ "block_id" : "budget-header" ,
721+ "text" : {"type" : "plain_text" , "text" : "1234567890" * 15 },
722+ }
723+ HeaderBlock (** input ).validate_json ()
724+
725+ def test_text_length_151 (self ):
726+ input = {
727+ "type" : "header" ,
728+ "block_id" : "budget-header" ,
729+ "text" : {"type" : "plain_text" , "text" : ("1234567890" * 15 ) + "1" },
730+ }
731+ with self .assertRaises (SlackObjectFormationError ):
732+ HeaderBlock (** input ).validate_json ()
733+
You can’t perform that action at this time.
0 commit comments