Skip to content

Commit

Permalink
Rename very_large_proto_module.cc to pass_proto2_message_module.cc
Browse files Browse the repository at this point in the history
This name makes more sense because the module is used in two tests.

No functional changes.

PiperOrigin-RevId: 623644578
  • Loading branch information
Ralf W. Grosse-Kunstleve authored and copybara-github committed Apr 10, 2024
1 parent b738a25 commit b538aff
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pybind11_protobuf/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 4 additions & 2 deletions pybind11_protobuf/tests/very_large_proto_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)


Expand Down
6 changes: 4 additions & 2 deletions pybind11_protobuf/tests/we_love_dashes_py_only_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@

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


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)


Expand Down

0 comments on commit b538aff

Please sign in to comment.