def testCopyCode_fromTypedToGeneric(self): """Tests copy_code from a generic to typed Code.""" typed_code = codes_pb2.AdministrativeGenderCode( value=codes_pb2.AdministrativeGenderCode.Value.FEMALE) generic_code = datatypes_pb2.Code() codes.copy_code(typed_code, generic_code) self.assertEqual('female', generic_code.value)
def testCopyCode_fromGenericToTyped(self): """Tests copy_code from a typed to a generic Code.""" typed_code = codes_pb2.AdministrativeGenderCode() generic_code = datatypes_pb2.Code(value='female') codes.copy_code(generic_code, typed_code) self.assertEqual(codes_pb2.AdministrativeGenderCode.Value.FEMALE, typed_code.value)
def testCopyCode_fromGenericToGeneric(self): """Tests copy_code form a generic to a generic Code.""" source = datatypes_pb2.Code(value='female') target = datatypes_pb2.Code() codes.copy_code(source, target) self.assertEqual('female', target.value)
def testGetCodeAsString_withStringValueType(self): """Tests get_code_as_string with a string value-field type.""" code = datatypes_pb2.Code(value='foo') self.assertEqual('foo', codes.get_code_as_string(code))