summaryrefslogtreecommitdiff
path: root/Lib/test/test_statistics.py
diff options
context:
space:
mode:
authorSteven D'Aprano <steve@pearwood.info>2016-07-08 02:38:45 +1000
committerSteven D'Aprano <steve@pearwood.info>2016-07-08 02:38:45 +1000
commit8c115a46e7c608d96b090d2bfd719cf028dbcd4f (patch)
tree391837d81d17a113f62bd8cfb0ea07a93e63dc25 /Lib/test/test_statistics.py
parent2954f8399914c77e048f9e3358abfadb7a3f76e9 (diff)
downloadcpython-git-8c115a46e7c608d96b090d2bfd719cf028dbcd4f.tar.gz
Issue27139 patch by Julio C Cardoza.
Diffstat (limited to 'Lib/test/test_statistics.py')
-rw-r--r--Lib/test/test_statistics.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_statistics.py b/Lib/test/test_statistics.py
index 5dd50483f2..4e03d983d3 100644
--- a/Lib/test/test_statistics.py
+++ b/Lib/test/test_statistics.py
@@ -1600,6 +1600,22 @@ class TestMedianGrouped(TestMedian):
data = [220, 220, 240, 260, 260, 260, 260, 280, 280, 300, 320, 340]
self.assertEqual(self.func(data, 20), 265.0)
+ def test_data_type_error(self):
+ # Test median_grouped with str, bytes data types for data and interval
+ data = ["", "", ""]
+ self.assertRaises(TypeError, self.func, data)
+ #---
+ data = [b"", b"", b""]
+ self.assertRaises(TypeError, self.func, data)
+ #---
+ data = [1, 2, 3]
+ interval = ""
+ self.assertRaises(TypeError, self.func, data, interval)
+ #---
+ data = [1, 2, 3]
+ interval = b""
+ self.assertRaises(TypeError, self.func, data, interval)
+
class TestMode(NumericTestCase, AverageMixin, UnivariateTypeMixin):
# Test cases for the discrete version of mode.