Пример #1
0
 def testCopyCode_fromTypedToTyped(self):
     """Tests copy_code from a typed to a typed Code."""
     source = codes_pb2.AdministrativeGenderCode(
         value=codes_pb2.AdministrativeGenderCode.Value.FEMALE)
     target = codes_pb2.AdministrativeGenderCode()
     codes.copy_code(source, target)
     self.assertEqual(codes_pb2.AdministrativeGenderCode.Value.FEMALE,
                      target.value)
Пример #2
0
 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)
Пример #3
0
 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)
Пример #4
0
 def testGetCodeAsString_withEnumValueType(self):
     """Tests get_code_as_string with an enum value-field type."""
     code = codes_pb2.AdministrativeGenderCode(
         value=codes_pb2.AdministrativeGenderCode.Value.FEMALE)
     self.assertEqual('female', codes.get_code_as_string(code))