MCPcopy Index your code
hub / github.com/python/cpython / test_zscore

Method test_zscore

Lib/test/test_statistics.py:3176–3189  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3174 NormalDist(1, 0).overlap(X) # left operand sigma is zero
3175
3176 def test_zscore(self):
3177 NormalDist = self.module.NormalDist
3178 X = NormalDist(100, 15)
3179 self.assertEqual(X.zscore(142), 2.8)
3180 self.assertEqual(X.zscore(58), -2.8)
3181 self.assertEqual(X.zscore(100), 0.0)
3182 with self.assertRaises(TypeError):
3183 X.zscore() # too few arguments
3184 with self.assertRaises(TypeError):
3185 X.zscore(1, 1) # too may arguments
3186 with self.assertRaises(TypeError):
3187 X.zscore(None) # non-numeric type
3188 with self.assertRaises(self.module.StatisticsError):
3189 NormalDist(1, 0).zscore(100) # sigma is zero
3190
3191 def test_properties(self):
3192 X = self.module.NormalDist(100, 15)

Callers

nothing calls this directly

Calls 4

zscoreMethod · 0.95
NormalDistClass · 0.85
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected