@@ -200,6 +200,61 @@ def test_add_methods_require_not_frozen(mock_account_ids, nft_id, mock_client):
200200 reject_tx .add_nft_id (nft_id )
201201
202202
203+ def test_add_token_id_rejects_invalid_type (mock_account_ids ):
204+ """Test that add_token_id rejects a value that is not a TokenId instance."""
205+ _ , _ , _ , token_id , _ = mock_account_ids
206+ nft_id = NftId (token_id = token_id , serial_number = 1 )
207+
208+ reject_tx = TokenRejectTransaction ()
209+
210+ with pytest .raises (TypeError , match = "token_id must be a TokenId instance." ):
211+ reject_tx .add_token_id (nft_id )
212+
213+ with pytest .raises (TypeError , match = "token_id must be a TokenId instance." ):
214+ reject_tx .add_token_id ("0.0.100" )
215+
216+ # The invalid inputs must not have been appended.
217+ assert reject_tx .token_ids == []
218+
219+
220+ def test_add_nft_id_rejects_invalid_type (mock_account_ids ):
221+ """Test that add_nft_id rejects a value that is not a NftId instance."""
222+ _ , _ , _ , token_id , _ = mock_account_ids
223+
224+ reject_tx = TokenRejectTransaction ()
225+
226+ with pytest .raises (TypeError , match = "nft_id must be a NftId instance." ):
227+ reject_tx .add_nft_id (token_id )
228+
229+ with pytest .raises (TypeError , match = "nft_id must be a NftId instance." ):
230+ reject_tx .add_nft_id ("0.0.100" )
231+
232+ # The invalid inputs must not have been appended.
233+ assert reject_tx .nft_ids == []
234+
235+
236+ def test_add_id_methods_do_not_mutate_caller_lists (mock_account_ids ):
237+ """Test that add_token_id/add_nft_id do not mutate lists passed to the constructor."""
238+ _ , _ , _ , token_id_1 , token_id_2 = mock_account_ids
239+ nft_id_1 = NftId (token_id = token_id_1 , serial_number = 1 )
240+ nft_id_2 = NftId (token_id = token_id_1 , serial_number = 2 )
241+
242+ token_ids = [token_id_1 ]
243+ nft_ids = [nft_id_1 ]
244+
245+ reject_tx = TokenRejectTransaction (token_ids = token_ids , nft_ids = nft_ids )
246+ reject_tx .add_token_id (token_id_2 )
247+ reject_tx .add_nft_id (nft_id_2 )
248+
249+ # The transaction reflects the appended IDs.
250+ assert reject_tx .token_ids == [token_id_1 , token_id_2 ]
251+ assert reject_tx .nft_ids == [nft_id_1 , nft_id_2 ]
252+
253+ # The caller's original lists remain untouched.
254+ assert token_ids == [token_id_1 ]
255+ assert nft_ids == [nft_id_1 ]
256+
257+
203258def test_reject_transaction_can_execute (mock_account_ids ):
204259 """Test that a reject transaction can be executed successfully."""
205260 account_id , owner_account_id , _ , token_id , _ = mock_account_ids
0 commit comments