Skip to content

Commit ad305e7

Browse files
committed
Improve docstrings for Approx classes.
1 parent 7d8688d commit ad305e7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/_pytest/python_api.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def _yield_comparisons(self, actual):
7878

7979
class ApproxNumpy(ApproxBase):
8080
"""
81-
Perform approximate comparisons for numpy arrays.
81+
Perform approximate comparisons where the expected value is numpy array.
8282
"""
8383

8484
def __repr__(self):
@@ -132,8 +132,8 @@ def _yield_comparisons(self, actual):
132132

133133
class ApproxMapping(ApproxBase):
134134
"""
135-
Perform approximate comparisons for mappings where the values are numbers
136-
(the keys can be anything).
135+
Perform approximate comparisons where the expected value is a mapping with
136+
numeric values (the keys can be anything).
137137
"""
138138

139139
def __repr__(self):
@@ -154,7 +154,8 @@ def _yield_comparisons(self, actual):
154154

155155
class ApproxSequence(ApproxBase):
156156
"""
157-
Perform approximate comparisons for sequences of numbers.
157+
Perform approximate comparisons where the expected value is a sequence of
158+
numbers.
158159
"""
159160

160161
def __repr__(self):
@@ -176,7 +177,7 @@ def _yield_comparisons(self, actual):
176177

177178
class ApproxScalar(ApproxBase):
178179
"""
179-
Perform approximate comparisons for single numbers only.
180+
Perform approximate comparisons where the expected value is a single number.
180181
"""
181182

182183
DEFAULT_ABSOLUTE_TOLERANCE = 1e-12
@@ -290,6 +291,9 @@ def set_default(x, default):
290291

291292

292293
class ApproxDecimal(ApproxScalar):
294+
"""
295+
Perform approximate comparisons where the expected value is a decimal.
296+
"""
293297
from decimal import Decimal
294298

295299
DEFAULT_ABSOLUTE_TOLERANCE = Decimal("1e-12")

0 commit comments

Comments
 (0)