diff options
author | Steven D'Aprano <steve@pearwood.info> | 2016-07-07 16:52:06 (GMT) |
---|---|---|
committer | Steven D'Aprano <steve@pearwood.info> | 2016-07-07 16:52:06 (GMT) |
commit | d6402a40d3b52aa945dfc0a875b05510e88a2dab (patch) | |
tree | e06cdbd0ef545321f1ee939b92fdfceb165078a7 | |
parent | 4afd143d3e615ce2d65bcededafb2e2bcda0768f (diff) | |
parent | 8c115a46e7c608d96b090d2bfd719cf028dbcd4f (diff) | |
download | cpython-d6402a40d3b52aa945dfc0a875b05510e88a2dab.zip cpython-d6402a40d3b52aa945dfc0a875b05510e88a2dab.tar.gz cpython-d6402a40d3b52aa945dfc0a875b05510e88a2dab.tar.bz2 |
Automated merge with ssh://hg.python.org/cpython
-rw-r--r-- | Lib/test/test_statistics.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_statistics.py b/Lib/test/test_statistics.py index 5dd5048..4e03d98 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. |