File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,6 +66,15 @@ def add_t(self, text):
6666 self .append (t )
6767 return t
6868
69+ @property
70+ def t_elms (self ):
71+ """
72+ Sequence of the <w:t> elements in this paragraph.
73+ """
74+ if not hasattr (self , 't' ):
75+ return ()
76+ return tuple ([t for t in self .t ])
77+
6978
7079class CT_Text (OxmlBaseElement ):
7180 """
Original file line number Diff line number Diff line change @@ -51,6 +51,18 @@ def it_can_add_a_t_to_itself(self):
5151 assert r .xml == an_r ().with_nsdecls ().with_t (text ).xml
5252 assert isinstance (t , CT_Text )
5353
54+ def it_has_a_sequence_of_the_t_elms_it_contains (self ):
55+ cases = (
56+ (an_r ().with_nsdecls (), 0 ),
57+ (an_r ().with_nsdecls ().with_t ('foo' ), 1 ),
58+ (an_r ().with_nsdecls ().with_t ('foo' ).with_t ('bar' ), 2 ),
59+ )
60+ for builder , expected_len in cases :
61+ r = builder .element
62+ assert len (r .t_elms ) == expected_len
63+ for t in r .t_elms :
64+ assert isinstance (t , CT_Text )
65+
5466
5567class DescribeCT_Text (object ):
5668
You can’t perform that action at this time.
0 commit comments