gtest_help_test: Make method names snake_case, conforming with [the style guide](https://google.github.io/styleguide/pyguide#316-naming)

PiperOrigin-RevId: 557133618
Change-Id: I27202ee91ee81b3d2e4c28102190d2bde8efba05
This commit is contained in:
Dino Radakovic 2023-08-15 07:59:51 -07:00 committed by Copybara-Service
parent 6513d0272d
commit dd9a956904

View File

@ -96,7 +96,7 @@ HELP_REGEX = re.compile(
) )
def RunWithFlag(flag): def run_with_flag(flag):
"""Runs gtest_help_test_ with the given flag. """Runs gtest_help_test_ with the given flag.
Returns: Returns:
@ -116,14 +116,14 @@ def RunWithFlag(flag):
class GTestHelpTest(gtest_test_utils.TestCase): class GTestHelpTest(gtest_test_utils.TestCase):
"""Tests the --help flag and its equivalent forms.""" """Tests the --help flag and its equivalent forms."""
def testPrintsHelpWithFullFlag(self): def test_prints_help_with_full_flag(self):
"""Verifies correct behavior when help flag is specified. """Verifies correct behavior when help flag is specified.
The right message must be printed and the tests must The right message must be printed and the tests must
skipped when the given flag is specified. skipped when the given flag is specified.
""" """
exit_code, output = RunWithFlag('--help') exit_code, output = run_with_flag('--help')
if HAS_ABSL_FLAGS: if HAS_ABSL_FLAGS:
# The Abseil flags library prints the ProgramUsageMessage() with # The Abseil flags library prints the ProgramUsageMessage() with
# --help and returns 1. # --help and returns 1.
@ -143,25 +143,25 @@ class GTestHelpTest(gtest_test_utils.TestCase):
else: else:
self.assertNotIn(DEATH_TEST_STYLE_FLAG, output) self.assertNotIn(DEATH_TEST_STYLE_FLAG, output)
def testRunsTestsWithoutHelpFlag(self): def test_runs_tests_without_help_flag(self):
"""Verifies correct behavior when no help flag is specified. """Verifies correct behavior when no help flag is specified.
Verifies that when no help flag is specified, the tests are run Verifies that when no help flag is specified, the tests are run
and the help message is not printed. and the help message is not printed.
""" """
exit_code, output = RunWithFlag(None) exit_code, output = run_with_flag(None)
self.assertNotEqual(exit_code, 0) self.assertNotEqual(exit_code, 0)
self.assertFalse(HELP_REGEX.search(output), output) self.assertFalse(HELP_REGEX.search(output), output)
def testRunsTestsWithGtestInternalFlag(self): def test_runs_tests_with_gtest_internal_flag(self):
"""Verifies correct behavior when internal testing flag is specified. """Verifies correct behavior when internal testing flag is specified.
Verifies that the tests are run and no help message is printed when Verifies that the tests are run and no help message is printed when
a flag starting with Google Test prefix and 'internal_' is supplied. a flag starting with Google Test prefix and 'internal_' is supplied.
""" """
exit_code, output = RunWithFlag(INTERNAL_FLAG_FOR_TESTING) exit_code, output = run_with_flag(INTERNAL_FLAG_FOR_TESTING)
self.assertNotEqual(exit_code, 0) self.assertNotEqual(exit_code, 0)
self.assertFalse(HELP_REGEX.search(output), output) self.assertFalse(HELP_REGEX.search(output), output)