no_import_no_strip_test.py
Go to the documentation of this file.
1 # Copyright 2020 the gRPC authors.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 import logging
16 import unittest
17 
18 
19 class ImportTest(unittest.TestCase):
20 
21  def test_import(self):
22  from namespaced.upper.example.namespaced_example_pb2 import \
23  NamespacedExample
24  namespaced_example = NamespacedExample()
25  namespaced_example.value = "hello"
26  # Superfluous assert, important part is namespaced example was imported.
27  self.assertEqual(namespaced_example.value, "hello")
28 
29  def test_grpc(self):
30  from namespaced.upper.example.namespaced_example_pb2_grpc import \
31  NamespacedServiceStub
32 
33  # No error from import
34  self.assertEqual(1, 1)
35 
36 
37 if __name__ == '__main__':
38  logging.basicConfig()
39  unittest.main()
no_import_no_strip_test.ImportTest.test_grpc
def test_grpc(self)
Definition: no_import_no_strip_test.py:29
no_import_no_strip_test.ImportTest.test_import
def test_import(self)
Definition: no_import_no_strip_test.py:21
no_import_no_strip_test.ImportTest
Definition: no_import_no_strip_test.py:19


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:32