def testMergeFromBadType(self):
    msg = map_unittest_pb2.TestMap()
    with self.assertRaisesRegexp(
        TypeError,
        r'Parameter to MergeFrom\(\) must be instance of same class: expected '
        r'.*TestMap got int\.'):
      msg.MergeFrom(1)