2 # Copyright 2020 The Pigweed Authors
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
8 # https://www.apache.org/licenses/LICENSE-2.0
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
15 """Tests compiling and importing Python protos on the fly."""
19 from pw_protobuf_compiler_protos import test_pb2 as top_level
20 from pw_protobuf_compiler_protos.nested.more_nesting import test_pb2
23 class TestCompileAndImport(unittest.TestCase):
24 def test_access_compiled_protobufs(self):
25 self.assertNotEqual(top_level.FOO, top_level.BAR)
27 message = test_pb2.Message(field=123)
28 self.assertEqual(message.field, 123)
31 if __name__ == '__main__':