Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: third_party/protobuf/python/google/protobuf/internal/service_reflection_test.py

Issue 1842653006: Update //third_party/protobuf to version 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/python/google/protobuf/internal/service_reflection_test.py
diff --git a/third_party/protobuf/python/google/protobuf/internal/service_reflection_test.py b/third_party/protobuf/python/google/protobuf/internal/service_reflection_test.py
index e04f8252c0400e79846195ba15a969339a657bfb..98614b77f63ae80e3a0f03a9457b71ac0ffca7af 100755
--- a/third_party/protobuf/python/google/protobuf/internal/service_reflection_test.py
+++ b/third_party/protobuf/python/google/protobuf/internal/service_reflection_test.py
@@ -1,8 +1,8 @@
-#! /usr/bin/python
+#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
-# http://code.google.com/p/protobuf/
+# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -34,7 +34,10 @@
__author__ = 'petar@google.com (Petar Petrov)'
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf import unittest_pb2
from google.protobuf import service_reflection
from google.protobuf import service
@@ -80,7 +83,7 @@ class FooUnitTest(unittest.TestCase):
self.assertEqual('Method Bar not implemented.',
rpc_controller.failure_message)
self.assertEqual(None, self.callback_response)
-
+
class MyServiceImpl(unittest_pb2.TestService):
def Foo(self, rpc_controller, request, done):
self.foo_called = True
@@ -118,15 +121,14 @@ class FooUnitTest(unittest.TestCase):
rpc_controller = 'controller'
request = 'request'
- # GetDescriptor now static, still works as instance method for compatability
+ # GetDescriptor now static, still works as instance method for compatibility
self.assertEqual(unittest_pb2.TestService_Stub.GetDescriptor(),
stub.GetDescriptor())
# Invoke method.
stub.Foo(rpc_controller, request, MyCallback)
- self.assertTrue(isinstance(self.callback_response,
- unittest_pb2.FooResponse))
+ self.assertIsInstance(self.callback_response, unittest_pb2.FooResponse)
self.assertEqual(request, channel.request)
self.assertEqual(rpc_controller, channel.controller)
self.assertEqual(stub.GetDescriptor().methods[0], channel.method)

Powered by Google App Engine
This is Rietveld 408576698