Correct argument name `user_msg` of `fail` in TestCase in absltest. The second argument isn't a prefix.
PiperOrigin-RevId: 545824525
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ff009c1..e4ec771 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,9 +16,12 @@
result, on Python 3.11+, the private `_cls_exit_stack` attribute is not
defined on `absltest.TestCase` and `_exit_stack` attribute is not defined on
its instances.
-* `AbslTest.assertSameStructure()` now uses the test case's equality functions
- (registered with `TestCase.addTypeEqualityFunc()`) for comparing leaves of
- the structure.
+* (testing) `absltest.TestCase.assertSameStructure()` now uses the test case's
+ equality functions (registered with `TestCase.addTypeEqualityFunc()`) for
+ comparing leaves of the structure.
+* (testing) `abslTest.TestCase.fail()` now names its arguments
+ `(self, msg=None, user_msg=None)`, and not `(self, msg=None, prefix=None)`,
+ better reflecting the behavior and usage of the two message arguments.
* `DEFINE_enum`, `DEFINE_multi_enum`, and `EnumParser` now raise errors when
`enum_values` is provided as a single string value. Additionally,
`EnumParser.enum_values` is now stored as a list copy of the provided
diff --git a/absl/testing/absltest.py b/absl/testing/absltest.py
index f067e61..45b3a57 100644
--- a/absl/testing/absltest.py
+++ b/absl/testing/absltest.py
@@ -1818,9 +1818,9 @@
return super(TestCase, self)._getAssertEqualityFunc(first, second)
- def fail(self, msg=None, prefix=None) -> NoReturn:
- """Fail immediately with the given message, optionally prefixed."""
- return super(TestCase, self).fail(self._formatMessage(prefix, msg))
+ def fail(self, msg=None, user_msg=None) -> NoReturn:
+ """Fail immediately with the given standard message and user message."""
+ return super(TestCase, self).fail(self._formatMessage(user_msg, msg))
def _sorted_list_difference(expected, actual):