From 3cef1bff2a40e5151baba883a971070233da4fb2 Mon Sep 17 00:00:00 2001 From: Samira-g-js Date: Wed, 19 Feb 2020 13:41:09 +0000 Subject: [PATCH 1/4] Added in a error message --- pandas/tests/arrays/test_array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/arrays/test_array.py b/pandas/tests/arrays/test_array.py index b1b5a9482e34f..122097b8edcd4 100644 --- a/pandas/tests/arrays/test_array.py +++ b/pandas/tests/arrays/test_array.py @@ -301,7 +301,7 @@ def test_array_unboxes(index_or_series): data = box([decimal.Decimal("1"), decimal.Decimal("2")]) # make sure it works - with pytest.raises(TypeError): + with pytest.raises(TypeError, "Invalid type provided"): DecimalArray2._from_sequence(data) result = pd.array(data, dtype="decimal2") From 3408a912765bc313be62e1851ec20aa26ec9118c Mon Sep 17 00:00:00 2001 From: Samira-g-js Date: Wed, 19 Feb 2020 14:34:04 +0000 Subject: [PATCH 2/4] Added in match string for error message --- pandas/tests/arrays/test_array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/arrays/test_array.py b/pandas/tests/arrays/test_array.py index 122097b8edcd4..c419871d601b7 100644 --- a/pandas/tests/arrays/test_array.py +++ b/pandas/tests/arrays/test_array.py @@ -301,7 +301,7 @@ def test_array_unboxes(index_or_series): data = box([decimal.Decimal("1"), decimal.Decimal("2")]) # make sure it works - with pytest.raises(TypeError, "Invalid type provided"): + with pytest.raises(TypeError, match= "Invalid type provided"): DecimalArray2._from_sequence(data) result = pd.array(data, dtype="decimal2") From 0d3c8c829184adb1fc4c8736421a2511704abf26 Mon Sep 17 00:00:00 2001 From: Samira-g-js Date: Wed, 19 Feb 2020 14:42:53 +0000 Subject: [PATCH 3/4] Removed whitespaces --- pandas/tests/arrays/test_array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/arrays/test_array.py b/pandas/tests/arrays/test_array.py index c419871d601b7..826e16dd39436 100644 --- a/pandas/tests/arrays/test_array.py +++ b/pandas/tests/arrays/test_array.py @@ -301,7 +301,7 @@ def test_array_unboxes(index_or_series): data = box([decimal.Decimal("1"), decimal.Decimal("2")]) # make sure it works - with pytest.raises(TypeError, match= "Invalid type provided"): + with pytest.raises(TypeError, match="Invalid type provided"): DecimalArray2._from_sequence(data) result = pd.array(data, dtype="decimal2") From a22dac7a09d2081f1ea84189fc5d31d9291c4b15 Mon Sep 17 00:00:00 2001 From: Samira-g-js Date: Thu, 27 Feb 2020 16:26:31 +0000 Subject: [PATCH 4/4] Added in specific TypeError message --- pandas/tests/arrays/test_array.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandas/tests/arrays/test_array.py b/pandas/tests/arrays/test_array.py index 826e16dd39436..f42b16cf18f20 100644 --- a/pandas/tests/arrays/test_array.py +++ b/pandas/tests/arrays/test_array.py @@ -291,7 +291,7 @@ class DecimalArray2(DecimalArray): @classmethod def _from_sequence(cls, scalars, dtype=None, copy=False): if isinstance(scalars, (pd.Series, pd.Index)): - raise TypeError + raise TypeError("scalars should not be of type pd.Series or pd.Index") return super()._from_sequence(scalars, dtype=dtype, copy=copy) @@ -301,7 +301,9 @@ def test_array_unboxes(index_or_series): data = box([decimal.Decimal("1"), decimal.Decimal("2")]) # make sure it works - with pytest.raises(TypeError, match="Invalid type provided"): + with pytest.raises( + TypeError, match="scalars should not be of type pd.Series or pd.Index" + ): DecimalArray2._from_sequence(data) result = pd.array(data, dtype="decimal2")