Commit Graph

29 Commits

Author SHA1 Message Date
mike 6e14585ca2 Fix approx default tolerances for Decimal 2018-02-21 23:08:23 +01:00
Florian Bruhin 3cbf0c8ec0 Raise unexpected exceptions with pytest.raises() using match= 2018-02-15 12:11:56 +01:00
Florian Bruhin 9849022eb2 Remove "matching '...'" part from the pytest.raises message
When a test with pytest.raises(ValueError, match='foo') doesn't raise, the
following error is printed:

    Failed: DID NOT RAISE <class 'ValueError'> matching 'foo'

This error message is confusing as it implies a ValueError was raised, but the
message wasn't matching 'foo'.

I first considered rewording it somehow to preserve the match pattern in it, but
I don't think that's worthwhile as the pattern should usually be apparent from
the stacktrace anyways (hard-coded, as parametrization, or with --showlocals for
more sophisticated cases).
2018-02-14 19:20:00 +01:00
Andy Freeland e5b527d0e3 Add Sphinx parameter docs for `match` and `message` args to `pytest.raises()` 2018-02-09 16:28:17 -08:00
Bruno Oliveira 983a09a2d4 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2017-11-10 18:33:02 -02:00
Bruno Oliveira b11640c1eb Fix linting E722: do not use bare except 2017-11-04 13:59:10 -02:00
Bruno Oliveira 4e581b637f Use zip and map from six 2017-10-24 22:13:32 -02:00
Bruno Oliveira 6821d36ca5 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2017-10-24 19:57:14 -02:00
Bruno Oliveira a3ec3df0c8 Add E722 and E741 flake errors to the ignore list
Also fixed 'E704 multiple statements on one line (def)' in python_api
2017-10-23 18:19:15 -02:00
hugovk ef732fc51d Remove code for unsupported Python versions 2017-10-10 08:54:56 +03:00
Bruno Oliveira f18780ed8a Update docs: ``match`` keyword was introduced in 3.1
Also update the text to recommend using the context-manager
over the callable/string forms.
2017-08-16 14:28:34 -03:00
Bruno Oliveira 763c580a2a Merge pull request #2576 from maiksensi/feat/raise-not-implemented-for-lt-gt-in-approx
#2003 Change behavior of `approx.py` to only support `__eq__` comparison
2017-07-30 17:48:33 -03:00
Ronny Pfannschmidt 06a49338b2 make Test Outcomes inherit from BaseException instead of exception
fixes #580
2017-07-28 15:28:51 +02:00
Bruno Oliveira 80f4699572 approx raises TypeError in Python 2 for comparison operators other than != and == 2017-07-25 20:07:10 -03:00
Maik Figura 57a232fc5a Remove out of scope change 2017-07-25 19:19:14 -03:00
Maik Figura f0936d42fb Fix linter errors 2017-07-25 19:17:58 -03:00
Maik Figura d3ab1b9df4 Add user documentation
The new doc section explains why we raise a `NotImplementedError`.
2017-07-25 19:17:58 -03:00
Kale Kundert ebc7346be4
Raise TypeError for types that can't be compared to arrays. 2017-07-22 09:05:12 -07:00
Kale Kundert 495f731760
Simplify how comparisons with numpy arrays work.
Previously I was subverting the natural order of operations by
subclassing from `ndarray`, but it turns out that you can tell just
numpy to call your operator instead of its by setting the
`__array_priority__` attribute on your class.  This is much simpler, and
it turns out the be a little more robust, too.
2017-07-22 07:52:03 -07:00
Bruno Oliveira 7b1870a94e Fix flake8 in features branch 2017-07-17 21:16:14 -03:00
Kale Kundert 7a1a439049
Use `cls` instead of `ApproxNumpyBase`.
Slightly more general, probably doesn't make a difference.
2017-07-04 09:20:52 -07:00
Kale Kundert c111e9dac3
Avoid making multiple ApproxNumpy types. 2017-07-03 22:45:24 -07:00
Kale Kundert 8524a57075
Add "approx" to all the repr-strings. 2017-07-03 22:44:37 -07:00
Kale Kundert 9597e674d9
Use sets to compare dictionary keys. 2017-06-16 08:25:13 -07:00
Kale Kundert 4d02863b16
Remove a dict-comprehension.
Not compatible with python26.
2017-06-15 18:56:09 -07:00
Kale Kundert 50769557e8
Skip the numpy doctests.
They seem like more trouble that they're worth.
2017-06-15 14:53:27 -07:00
Kale Kundert 8badb47db6
Implement suggestions from code review.
- Avoid importing numpy unless necessary.

- Mention numpy arrays and dictionaries in the docs.

- Add numpy to the list of tox dependencies.

- Don't unnecessarily copy arrays or allocate empty space for them.

- Use code from compat.py rather than writing py2/3 versions of things
  myself.

- Avoid reimplementing __repr__ for built-in types.

- Add an option to consider NaN == NaN, because sometimes people use NaN
  to mean "missing data".
2017-06-15 09:19:10 -07:00
Kale Kundert 8c22aee256
Resolve merge conflict due to approx being moved. 2017-06-11 19:46:59 -07:00
Ronny Pfannschmidt 6be57a3711 move python api helpers out of the python module
this separates exposed normal api from collection elements
2017-06-11 12:27:16 +02:00