Skip to content

Commit

Permalink
More Python 3.12 fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jburnim committed Mar 11, 2024
1 parent 7d9143a commit eefc0a0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tensorflow_probability/python/bijectors/bijector_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ class BaseBijectorTest(test_util.TestCase):
"""Tests properties of the Bijector base-class."""

def testIsAbstract(self):
with self.assertRaisesRegexp(TypeError,
('Can\'t instantiate abstract class Bijector '
'with abstract methods? __init__')):
with self.assertRaisesRegex(TypeError,
('Can\'t instantiate abstract class Bijector '
'with.* abstract methods? \'?__init__')):
bijector_lib.Bijector() # pylint: disable=abstract-class-instantiated

def testDefaults(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,7 @@ def dist():
warnings.simplefilter('always')
with warnings.catch_warnings(record=True) as w:
d.sample(seed=test_util.test_seed())
self.assertRegexpMatches(
self.assertRegex(
str(w[0].message),
r'Falling back to stateful sampling for distribution #1.*'
r'of type.*StatefulNormal.*component name "loc" and `dist.name` '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,10 @@ def testWarnings(self):
_, _ = mh.one_step(current_state, init_kernel_results,
seed=test_util.test_seed())
w = sorted(w, key=lambda w: str(w.message))
self.assertRegexpMatches(
self.assertRegex(
str(w[0].message),
r'`TransitionKernel` is already calibrated')
self.assertRegexpMatches(
self.assertRegex(
str(w[1].message),
r'`TransitionKernel` does not have a `log_acceptance_correction`')

Expand Down

0 comments on commit eefc0a0

Please sign in to comment.