(self)
| 2296 | self.assertNotEqual(small_gm, 0.0) |
| 2297 | |
| 2298 | def test_error_cases(self): |
| 2299 | geometric_mean = statistics.geometric_mean |
| 2300 | StatisticsError = statistics.StatisticsError |
| 2301 | with self.assertRaises(StatisticsError): |
| 2302 | geometric_mean([]) # empty input |
| 2303 | with self.assertRaises(StatisticsError): |
| 2304 | geometric_mean([3.5, -4.0, 5.25]) # negative input |
| 2305 | with self.assertRaises(StatisticsError): |
| 2306 | geometric_mean([0.0, -4.0, 5.25]) # negative input with zero |
| 2307 | with self.assertRaises(StatisticsError): |
| 2308 | geometric_mean([3.5, -math.inf, 5.25]) # negative infinity |
| 2309 | with self.assertRaises(StatisticsError): |
| 2310 | geometric_mean(iter([])) # empty iterator |
| 2311 | with self.assertRaises(TypeError): |
| 2312 | geometric_mean(None) # non-iterable input |
| 2313 | with self.assertRaises(TypeError): |
| 2314 | geometric_mean([10, None, 20]) # non-numeric input |
| 2315 | with self.assertRaises(TypeError): |
| 2316 | geometric_mean() # missing data argument |
| 2317 | with self.assertRaises(TypeError): |
| 2318 | geometric_mean([10, 20, 60], 70) # too many arguments |
| 2319 | |
| 2320 | def test_special_values(self): |
| 2321 | # Rules for special values are inherited from math.fsum() |
nothing calls this directly
no test coverage detected