Comments (6)
Thanks for the suggestion. How does that look?
from ensure.
Definitely better. What do you think of making each method return something, even self
? That way you can stack assertions, e.g.:
(ensure(9)
.is_greater_than(1)
.is_less_than(10))
from ensure.
I'd like to keep the assertion language grammatically correct wherever feasible, so I'd rather return another proxy inspector that can access the subject via .and
: ensure(9).is_greater_than(1).and.is_less_than(10)
from ensure.
With and
being a keyword, will that work? and_
would, but that's a bit ugly. I'll be the first to applaud grammatically correct APIs--that's part of the joy of a fluent interface. But don't forget that "practicality beats purity".
That being said, the design decision lies with you. Thanks for releasing this library--I find it useful on a weekly basis. I look forward to seeing these updates hit PyPI!
from ensure.
Yes, you're right. I'm thinking of using "also" instead of "and".
from ensure.
Released in v0.4.0, please test.
from ensure.
Related Issues (15)
- Fails with default arguments HOT 1
- Suggestion: check for a "numeric" string HOT 2
- Conditionally allow None HOT 4
- Custom predicates? HOT 2
- PEP 484/typing support
- Allow tracebacks to not descend into predicates
- Unittest2 support
- Return boolean values? HOT 2
- .or_raises fails on KeyInspector and ChainInspector objects HOT 3
- has_key() triggers linters HOT 2
- Support an is_sorted condition HOT 3
- Adjust to upcoming Python 3.8 / fix deprecation warning HOT 1
- _pickle.PicklingError: Can't pickle X: it's not the same object as __main__.X HOT 2
- or_raise(Exception, string) encounters a KeyError when string contains {} HOT 1
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 ensure.