@@ -63,6 +63,17 @@ def when_I_assign_comment_eq_comments_add_comment_with_author_and_initials(conte
63
63
context .comment = context .comments .add_comment (author = "John Doe" , initials = "JD" )
64
64
65
65
66
+ @when ('I assign comment = document.add_comment(runs, "A comment", "John Doe", "JD")' )
67
+ def when_I_assign_comment_eq_document_add_comment (context : Context ):
68
+ runs = list (context .document .paragraphs [0 ].runs )
69
+ context .comment = context .document .add_comment (
70
+ runs = runs ,
71
+ text = "A comment" ,
72
+ author = "John Doe" ,
73
+ initials = "JD" ,
74
+ )
75
+
76
+
66
77
@when ('I assign "{initials}" to comment.initials' )
67
78
def when_I_assign_initials (context : Context , initials : str ):
68
79
context .comment .initials = initials
@@ -98,10 +109,9 @@ def when_I_call_comments_get_2(context: Context):
98
109
# then =====================================================
99
110
100
111
101
- @then ("comment.author is the author of the comment" )
102
- def then_comment_author_is_the_author_of_the_comment (context : Context ):
103
- actual = context .comment .author
104
- assert actual == "Steve Canny" , f"expected author 'Steve Canny', got '{ actual } '"
112
+ @then ("comment is a Comment object" )
113
+ def then_comment_is_a_Comment_object (context : Context ):
114
+ assert type (context .comment ) is Comment
105
115
106
116
107
117
@then ('comment.author == "{author}"' )
@@ -110,6 +120,12 @@ def then_comment_author_eq_author(context: Context, author: str):
110
120
assert actual == author , f"expected author '{ author } ', got '{ actual } '"
111
121
112
122
123
+ @then ("comment.author is the author of the comment" )
124
+ def then_comment_author_is_the_author_of_the_comment (context : Context ):
125
+ actual = context .comment .author
126
+ assert actual == "Steve Canny" , f"expected author 'Steve Canny', got '{ actual } '"
127
+
128
+
113
129
@then ("comment.comment_id == 0" )
114
130
def then_comment_id_is_0 (context : Context ):
115
131
assert context .comment .comment_id == 0
@@ -146,6 +162,13 @@ def then_comment_paragraphs_idx_style_name_eq_style(context: Context, idx: str,
146
162
assert actual == expected , f"expected style name '{ expected } ', got '{ actual } '"
147
163
148
164
165
+ @then ('comment.text == "{text}"' )
166
+ def then_comment_text_eq_text (context : Context , text : str ):
167
+ actual = context .comment .text
168
+ expected = text
169
+ assert actual == expected , f"expected text '{ expected } ', got '{ actual } '"
170
+
171
+
149
172
@then ("comment.timestamp is the date and time the comment was authored" )
150
173
def then_comment_timestamp_is_the_date_and_time_the_comment_was_authored (context : Context ):
151
174
assert context .comment .timestamp == dt .datetime (2025 , 6 , 7 , 11 , 20 , 0 , tzinfo = dt .timezone .utc )
0 commit comments