Giter VIP home page Giter VIP logo

Comments (4)

jml avatar jml commented on August 21, 2024

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.

thomir avatar thomir commented on August 21, 2024

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.

rbtcollins avatar rbtcollins commented on August 21, 2024

+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.

mithrandi avatar mithrandi commented on August 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.