<s> import unittest <EOL> import pytest <EOL> from proto_lib_fixture import proto_lib <EOL> TestIsInitialized = None <EOL> SubMessage = None <EOL> TestWithRequiredSubMessage = None <EOL> @ pytest . mark . usefixtures ( '<STR_LIT>' ) <EOL> class MergeFromTest ( unittest . TestCase ) : <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> global TestIsInitialized , SubMessage , TestWithRequiredSubMessage <EOL> from test_is_initialized_proto import TestIsInitialized , SubMessage , TestWithRequiredSubMessage <EOL> def test_new_message_is_not_initialized ( self ) : <EOL> message = TestIsInitialized ( ) <EOL> self . assertFalse ( message . IsInitialized ( ) ) <EOL> def test_message_with_all_required_fields_set_is_initialized ( self ) : <EOL> message = TestIsInitialized ( ) <EOL> message . req_field = <NUM_LIT:1> <EOL> self . assertTrue ( message . IsInitialized ( ) ) <EOL> def test_new_message_with_required_submessage_is_not_initialized ( self ) : <EOL> message = TestWithRequiredSubMessage ( ) <EOL> self . assertFalse ( message . IsInitialized ( ) ) <EOL> def test_message_with_initialized_required_submessage_is_initialized ( self ) : <EOL> message = TestWithRequiredSubMessage ( ) <EOL> message . req_sub . req_field = <NUM_LIT:1> <EOL> self . assertTrue ( message . IsInitialized ( ) ) <EOL> def test_message_with_uninitialized_submessage_is_not_initialized ( self ) : <EOL> message = TestIsInitialized ( ) <EOL> message . req_field = <NUM_LIT:1> <EOL> message . sub_message . opt_field = <NUM_LIT:2> <EOL> self . assertFalse ( message . IsInitialized ( ) ) <EOL> def test_message_with_initialized_submessage_is_initialized ( self ) : <EOL> message = TestIsInitialized ( ) <EOL> message . req_field = <NUM_LIT:1> <EOL> message . sub_message . req_field = <NUM_LIT:2> <EOL> self . assertTrue ( message . IsInitialized ( ) ) <EOL> def test_message_with_uninitialized_repeated_submessage_is_not_initialized ( self ) : <EOL> message = TestIsInitialized ( ) <EOL> message . req_field = <NUM_LIT:1> <EOL> message . list_sub . add ( ) . opt_field = <NUM_LIT:2> <EOL> self . assertFalse ( message . IsInitialized ( ) ) <EOL> def test_message_with_initialized_repeated_submessage_is_initialized ( self ) : <EOL> message = TestIsInitialized ( ) <EOL> message . req_field = <NUM_LIT:1> <EOL> message . list_sub . add ( ) . req_field = <NUM_LIT:2> <EOL> self . assertTrue ( message . IsInitialized ( ) ) </s>
