From 5e2dcd4122b12c84ec528ecf13eff77bae3bf93c Mon Sep 17 00:00:00 2001 From: Vikash Singh <3116482+vi3k6i5@users.noreply.github.com> Date: Tue, 15 Jun 2021 15:04:03 +0530 Subject: [PATCH 1/3] fix: remove error msg check from test_decimal_precision_limit --- tests/system/django_spanner/test_decimal.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/system/django_spanner/test_decimal.py b/tests/system/django_spanner/test_decimal.py index 63f378a8eb..96be110e5f 100644 --- a/tests/system/django_spanner/test_decimal.py +++ b/tests/system/django_spanner/test_decimal.py @@ -89,12 +89,10 @@ def test_decimal_precision_limit(self): """ num_val = Number(num=Decimal(1) / Decimal(3)) if USE_EMULATOR: - msg = "The NUMERIC type supports 38 digits of precision and 9 digits of scale." - with self.assertRaisesRegex(IntegrityError, msg): + with self.assertRaises(ValueError): num_val.save() else: - msg = "400 Invalid value for bind parameter a0: Expected NUMERIC." - with self.assertRaisesRegex(ProgrammingError, msg): + with self.assertRaisesRegex(ProgrammingError): num_val.save() def test_decimal_update(self): From 15485b457499e2ae212bd05d05f1b544d456972b Mon Sep 17 00:00:00 2001 From: Vikash Singh <3116482+vi3k6i5@users.noreply.github.com> Date: Tue, 15 Jun 2021 15:09:27 +0530 Subject: [PATCH 2/3] refactor: lint fixes --- tests/system/django_spanner/test_decimal.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/system/django_spanner/test_decimal.py b/tests/system/django_spanner/test_decimal.py index 96be110e5f..778b5f8702 100644 --- a/tests/system/django_spanner/test_decimal.py +++ b/tests/system/django_spanner/test_decimal.py @@ -7,7 +7,6 @@ from .models import Author, Number from django.test import TransactionTestCase from django.db import connection, ProgrammingError -from django.db.utils import IntegrityError from decimal import Decimal from tests.system.django_spanner.utils import ( setup_instance, From 10a2124094d66b78690f53c434d3ad852ec963c2 Mon Sep 17 00:00:00 2001 From: Vikash Singh <3116482+vi3k6i5@users.noreply.github.com> Date: Tue, 15 Jun 2021 17:53:48 +0530 Subject: [PATCH 3/3] fix: changed assertRaisesRegex to assertRaises for non emmulator test case in test_decimal_precision_limit --- tests/system/django_spanner/test_decimal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/django_spanner/test_decimal.py b/tests/system/django_spanner/test_decimal.py index 778b5f8702..73df7e796b 100644 --- a/tests/system/django_spanner/test_decimal.py +++ b/tests/system/django_spanner/test_decimal.py @@ -91,7 +91,7 @@ def test_decimal_precision_limit(self): with self.assertRaises(ValueError): num_val.save() else: - with self.assertRaisesRegex(ProgrammingError): + with self.assertRaises(ProgrammingError): num_val.save() def test_decimal_update(self):