Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions firestore/tests/unit/test_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@


class TestOrder(unittest.TestCase):

if six.PY2:
assertRaisesRegex = unittest.TestCase.assertRaisesRegexp

@staticmethod
def _get_target_class():
from google.cloud.firestore_v1beta1.order import Order
Expand Down Expand Up @@ -175,7 +179,7 @@ def test_typeorder_type_failure(self):
left = mock.Mock()
left.WhichOneof.return_value = "imaginary-type"

with self.assertRaisesRegexp(ValueError, "Could not detect value"):
with self.assertRaisesRegex(ValueError, "Could not detect value"):
target.compare(left, mock.Mock())

def test_failure_to_find_type(self):
Expand All @@ -187,7 +191,7 @@ def test_failure_to_find_type(self):
# expect this to fail with value error.
with mock.patch.object(TypeOrder, 'from_value',) as to:
to.value = None
with self.assertRaisesRegexp(
with self.assertRaisesRegex(
ValueError, "'Unknown ``value_type``"
):
target.compare(left, right)
Expand Down
7 changes: 5 additions & 2 deletions firestore/tests/unit/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
import unittest

import mock
import six


class TestQuery(unittest.TestCase):

if six.PY2:
assertRaisesRegex = unittest.TestCase.assertRaisesRegexp

@staticmethod
def _get_target_class():
from google.cloud.firestore_v1beta1.query import Query
Expand Down Expand Up @@ -943,8 +947,7 @@ def test_comparator_missing_order_by_field_in_data_raises(self):
doc2._data = {'first': {'stringValue': 'Ada'},
'last': {'stringValue': 'lovelace'}}

with self.assertRaisesRegexp(ValueError,
"Can only compare fields "):
with self.assertRaisesRegex(ValueError, "Can only compare fields "):
query._comparator(doc1, doc2)


Expand Down