Ejemplo n.º 1
0
 def test_different_failure_fails(self):
     # A Deferred that has fired with a failure matches against the value
     # it was fired with.
     fail = make_failure(RuntimeError('arbitrary failure'))
     deferred = defer.fail(fail)
     matcher = Is(None)  # Something that doesn't match `fail`.
     mismatch = matcher.match(fail)
     self.assertThat(
         self.match(matcher, deferred),
         mismatches(Equals(mismatch.describe()),
                    Equals(mismatch.get_details())))
Ejemplo n.º 2
0
 def test_different_failure_fails(self):
     # A Deferred that has fired with a failure matches against the value
     # it was fired with.
     fail = make_failure(RuntimeError('arbitrary failure'))
     deferred = defer.fail(fail)
     matcher = Is(None)  # Something that doesn't match `fail`.
     mismatch = matcher.match(fail)
     self.assertThat(
         self.match(matcher, deferred),
         mismatches(Equals(mismatch.describe()),
                    Equals(mismatch.get_details())))
Ejemplo n.º 3
0
 def test_different_succeeded_result_fails(self):
     # A Deferred that has fired successfully matches against the value it
     # was fired with.
     result = object()
     deferred = defer.succeed(result)
     matcher = Is(None)  # Something that doesn't match `result`.
     mismatch = matcher.match(result)
     self.assertThat(
         self.match(matcher, deferred),
         mismatches(Equals(mismatch.describe()),
                    Equals(mismatch.get_details())))
Ejemplo n.º 4
0
 def test_different_succeeded_result_fails(self):
     # A Deferred that has fired successfully matches against the value it
     # was fired with.
     result = object()
     deferred = defer.succeed(result)
     matcher = Is(None)  # Something that doesn't match `result`.
     mismatch = matcher.match(result)
     self.assertThat(
         self.match(matcher, deferred),
         mismatches(Equals(mismatch.describe()),
                    Equals(mismatch.get_details())))