From b538aff596688fbd7d1afc4a8cb1d3fd99a64a8f Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 10 Apr 2024 16:51:29 -0700 Subject: [PATCH] Rename very_large_proto_module.cc to pass_proto2_message_module.cc This name makes more sense because the module is used in two tests. No functional changes. PiperOrigin-RevId: 623644578 --- pybind11_protobuf/tests/BUILD | 6 +++--- ..._large_proto_module.cc => pass_proto2_message_module.cc} | 2 +- pybind11_protobuf/tests/very_large_proto_test.py | 6 ++++-- pybind11_protobuf/tests/we_love_dashes_py_only_test.py | 6 ++++-- 4 files changed, 12 insertions(+), 8 deletions(-) rename pybind11_protobuf/tests/{very_large_proto_module.cc => pass_proto2_message_module.cc} (92%) diff --git a/pybind11_protobuf/tests/BUILD b/pybind11_protobuf/tests/BUILD index 3309431..dce695c 100644 --- a/pybind11_protobuf/tests/BUILD +++ b/pybind11_protobuf/tests/BUILD @@ -273,8 +273,8 @@ py_test( # Externally this is currently only built but not used. pybind_extension( - name = "very_large_proto_module", - srcs = ["very_large_proto_module.cc"], + name = "pass_proto2_message_module", + srcs = ["pass_proto2_message_module.cc"], deps = [ "//pybind11_protobuf:native_proto_caster", "@com_google_protobuf//:protobuf", @@ -394,7 +394,7 @@ py_test( name = "we_love_dashes_py_only_test", srcs = ["we_love_dashes_py_only_test.py"], deps = [ - ":very_large_proto_module", + ":pass_proto2_message_module", ":we-love-dashes_py_pb2", "@com_google_absl_py//absl/testing:absltest", "@com_google_protobuf//:protobuf_python", diff --git a/pybind11_protobuf/tests/very_large_proto_module.cc b/pybind11_protobuf/tests/pass_proto2_message_module.cc similarity index 92% rename from pybind11_protobuf/tests/very_large_proto_module.cc rename to pybind11_protobuf/tests/pass_proto2_message_module.cc index fdff9e7..c8c34b8 100644 --- a/pybind11_protobuf/tests/very_large_proto_module.cc +++ b/pybind11_protobuf/tests/pass_proto2_message_module.cc @@ -10,7 +10,7 @@ #include "google/protobuf/message.h" #include "pybind11_protobuf/native_proto_caster.h" -PYBIND11_MODULE(very_large_proto_module, m) { +PYBIND11_MODULE(pass_proto2_message_module, m) { pybind11_protobuf::ImportNativeProtoCasters(); m.def("get_space_used_estimate", diff --git a/pybind11_protobuf/tests/very_large_proto_test.py b/pybind11_protobuf/tests/very_large_proto_test.py index 83eb4e6..0af4c46 100644 --- a/pybind11_protobuf/tests/very_large_proto_test.py +++ b/pybind11_protobuf/tests/very_large_proto_test.py @@ -5,8 +5,8 @@ from absl.testing import absltest +from pybind11_protobuf.tests import pass_proto2_message_module from pybind11_protobuf.tests import test_pb2 -from pybind11_protobuf.tests import very_large_proto_module as m class MessageTest(absltest.TestCase): @@ -18,7 +18,9 @@ def test_greater_than_2gb_limit(self): kb = 1024 msg_size = 2 * kb**3 + kb # A little over 2 GB. msg = test_pb2.TestMessage(string_value='x' * msg_size) - space_used_estimate = m.get_space_used_estimate(msg) + space_used_estimate = pass_proto2_message_module.get_space_used_estimate( + msg + ) self.assertGreater(space_used_estimate, msg_size) diff --git a/pybind11_protobuf/tests/we_love_dashes_py_only_test.py b/pybind11_protobuf/tests/we_love_dashes_py_only_test.py index 0201a13..e03483c 100644 --- a/pybind11_protobuf/tests/we_love_dashes_py_only_test.py +++ b/pybind11_protobuf/tests/we_love_dashes_py_only_test.py @@ -5,7 +5,7 @@ from absl.testing import absltest -from pybind11_protobuf.tests import very_large_proto_module +from pybind11_protobuf.tests import pass_proto2_message_module from pybind11_protobuf.tests import we_love_dashes_pb2 @@ -13,7 +13,9 @@ class MessageTest(absltest.TestCase): def test_pass_proto2_message(self): msg = we_love_dashes_pb2.TokenEffort(score=345) - space_used_estimate = very_large_proto_module.get_space_used_estimate(msg) + space_used_estimate = pass_proto2_message_module.get_space_used_estimate( + msg + ) self.assertGreater(space_used_estimate, 0)