Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / pigweed / repo / pw_protobuf_compiler / py / compiled_protos_test.py
1 #!/usr/bin/env python3
2 # Copyright 2020 The Pigweed Authors
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 # use this file except in compliance with the License. You may obtain a copy of
6 # the License at
7 #
8 #     https://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations under
14 # the License.
15 """Tests compiling and importing Python protos on the fly."""
16
17 import unittest
18
19 from pw_protobuf_compiler_protos import test_pb2 as top_level
20 from pw_protobuf_compiler_protos.nested.more_nesting import test_pb2
21
22
23 class TestCompileAndImport(unittest.TestCase):
24     def test_access_compiled_protobufs(self):
25         self.assertNotEqual(top_level.FOO, top_level.BAR)
26
27         message = test_pb2.Message(field=123)
28         self.assertEqual(message.field, 123)
29
30
31 if __name__ == '__main__':
32     unittest.main()