Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/scipy/stats/_warnings_errors.py: 40%

20 statements  

« prev     ^ index     » next       coverage.py v7.3.2, created at 2023-12-12 06:31 +0000

1# Warnings 

2 

3 

4class DegenerateDataWarning(RuntimeWarning): 

5 """Warns when data is degenerate and results may not be reliable.""" 

6 def __init__(self, msg=None): 

7 if msg is None: 

8 msg = ("Degenerate data encountered; results may not be reliable.") 

9 self.args = (msg,) 

10 

11 

12class ConstantInputWarning(DegenerateDataWarning): 

13 """Warns when all values in data are exactly equal.""" 

14 def __init__(self, msg=None): 

15 if msg is None: 

16 msg = ("All values in data are exactly equal; " 

17 "results may not be reliable.") 

18 self.args = (msg,) 

19 

20 

21class NearConstantInputWarning(DegenerateDataWarning): 

22 """Warns when all values in data are nearly equal.""" 

23 def __init__(self, msg=None): 

24 if msg is None: 

25 msg = ("All values in data are nearly equal; " 

26 "results may not be reliable.") 

27 self.args = (msg,) 

28 

29 

30# Errors 

31 

32 

33class FitError(RuntimeError): 

34 """Represents an error condition when fitting a distribution to data.""" 

35 def __init__(self, msg=None): 

36 if msg is None: 

37 msg = ("An error occured when fitting a distribution to data.") 

38 self.args = (msg,)