Comments (4)
This sort of makes me think more that matchers should have a heap of methods on them. e.g.
p.implies(q)
p.after(f).on_mismatch(g)
But each such method added has a huge impact on compatibility.
The Not
case sort of already has a bug: https://bugs.launchpad.net/testtools/+bug/704219
I don't know the solution to it, but I suspect that requiring the Mismatch
to also provide the mismatched object (as mentioned in #211) might be a part of it.
from testtools.
But each such method added has a huge impact on compatibility.
I agree with @jml. I'd be concerned about adding any complexity to the matcher API. I'm also not entirely sure what the use case is for this. What tests are currently awkward to write that this would resolve?
from testtools.
+1 on being able to propogate the message from an annotated matcher to a higher order matcher.
I think calling a matcher that matches with what you wrote 'If' would be very confusing, because
if foo:
pass
looks for the truthiness of foo, whereas you're looking for whether p->q has been disproven.
I don't think we should have a heap of methods on matchers. What methods should we add? Why? Why those and not others?
from testtools.
The analogy is that this:
self.assertThat(blah, If(Not(Is(None)), GreaterThan(42)))
is equivalent to this:
if blah is not None:
self.assertGreaterThan(blah, 42)
I can see how that might be confusing, though.
from testtools.
Related Issues (20)
- Please make a new release HOT 2
- Deprecate testtools.distutilscmd?
- `TestCase.subTest` does not isolate tests
- “It is no longer useless …” in NEWS
- Release to support Python 3.10 HOT 1
- Update `doc/description.rst`
- trailing newline in str comparison is hard to spot
- Compatibility with Python 3.11
- The testtools documentation on readthedocs is not up to date. HOT 3
- 2.5.0 + master: sphinx warnings `reference target not found`
- 2.5.0 + master (b68af1b0): pytest is failing HOT 18
- Test failures with PyPy3.9 HOT 2
- deprecation warning on Python 3.11: 'cgi' is deprecated and slated for removal in Python 3.13 HOT 1
- testcase.py __eq__ function throwing an error
- AttributeError: module 'email' has no attribute 'message' HOT 1
- `testtools` fails to import with Python 3.12 HOT 4
- Issue a python3.12 release HOT 1
- 2.7.0 sdist is unusable (builds version "0.0.0")
- Missing dependency on fixtures since 2.7.0 HOT 1
- Pytest 8: AttributeError: 'TestExpectedException' object has no attribute 'runTest'. Did you mean: 'subTest'? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testtools.