@@ -328,7 +328,7 @@ def test_constructor(multiple_custom_fees, key_type, use_private):
328328 fee_exempt_keys = fee_exempt_keys ,
329329 )
330330
331- assert tx .memo == "Test Topic"
331+ assert tx .topic_memo == "Test Topic"
332332 assert tx .admin_key == admin_key
333333 assert tx .submit_key == submit_key
334334 assert tx .custom_fees == multiple_custom_fees
@@ -339,7 +339,7 @@ def test_constructor(multiple_custom_fees, key_type, use_private):
339339def test_constructor_default_values ():
340340 """Test constructor with default values."""
341341 tx_default = TopicCreateTransaction ()
342- assert tx_default .memo == ""
342+ assert tx_default .topic_memo == ""
343343 assert tx_default .admin_key is None
344344 assert tx_default .submit_key is None
345345 assert tx_default .custom_fees == []
@@ -627,3 +627,27 @@ def test_freeze_with_leaves_auto_renew_account_unset_without_operator(mock_clien
627627 body = frozen_tx .build_transaction_body ()
628628
629629 assert not body .consensusCreateTopic .HasField ("autoRenewAccount" )
630+
631+
632+ def test_topic_memo_does_not_collide_with_transaction_memo ():
633+ """Regression test for: topic and transaction memos remain independent."""
634+ tx = TopicCreateTransaction (memo = "my topic memo" )
635+ assert tx .topic_memo == "my topic memo"
636+ assert tx .memo == "" # base Transaction-level memo defaults independently
637+
638+ tx .set_transaction_memo ("some unrelated audit note" )
639+
640+ assert tx .topic_memo == "my topic memo" , "topic_memo was clobbered by set_transaction_memo()"
641+ assert tx .memo == "some unrelated audit note"
642+
643+
644+ def test_topic_memo_reflected_in_protobuf_independent_of_transaction_memo (mock_client ):
645+ """Verify protobuf preserves separate topic and transaction memos."""
646+ tx = TopicCreateTransaction (memo = "my topic memo" )
647+ tx .set_transaction_memo ("some unrelated audit note" )
648+ tx .transaction_id = TransactionId .generate (AccountId (0 , 0 , 1234 ))
649+ frozen_tx = tx .freeze_with (mock_client )
650+ body = frozen_tx .build_transaction_body ()
651+
652+ assert body .consensusCreateTopic .memo == "my topic memo"
653+ assert body .memo == "some unrelated audit note"
0 commit comments