Repository: grappa-py/grappa

Issue:
Assertion Errors
Love the library. It is super useful! 

I am trying to figure out how to see if a function raises an exception when called with a certain set of parameters. 

Here is an example (a bit contrived as I am trying to raise my own Exception based on valid inputs). 

```python
t = [0,1,2]
t.index(3) | should.raise_error(ValueError)
```

Right now the should.raise_error expects a function to be passed into it. 

Eg.
```python
t.index | should.raise_error(ValueError)
```

Right now I have to compose the test this way. 

```python
err = ""
try:
    self.index(3)
except Exception as err:
   error = err

error | should.be.an.instance.of(ValueError)
```

Am I missing Something?


Discussion:

Patch:
diff --git a/grappa/operator.py b/grappa/operator.py
index 2976373..46c67d0 100644
--- a/grappa/operator.py
+++ b/grappa/operator.py
@@ -208,7 +208,7 @@ class Operator(object):
             return self.run_matcher(*args, **kw)
 
     def __enter__(self):
-        raise NotImplementedError('operator cannot be used as "with" statement')  # noqa
+        raise NotImplementedError('operator cannot be used like "with" statement')  # noqa
 
     def __exit__(self, etype, value, traceback):
         self.__enter__()
diff --git a/grappa/operators/raises.py b/grappa/operators/raises.py
index 48dcea9..763f2a5 100644
--- a/grappa/operators/raises.py
+++ b/grappa/operators/raises.py
@@ -1,5 +1,4 @@
 # -*- coding: utf-8 -*-
-import inspect
 from ..operator import Operator
 
 
@@ -57,7 +56,7 @@ class RaisesOperator(Operator):
     )
 
     def match(self, fn, *errors):
-        if not any([inspect.isfunction(fn) or inspect.ismethod(fn)]):
+        if not callable(fn):
             return False, ['subject must be a function or method']
 
         try:


Test patch:
diff --git a/tests/operators/raises_test.py b/tests/operators/raises_test.py
index 33f4277..a3acdfa 100644
--- a/tests/operators/raises_test.py
+++ b/tests/operators/raises_test.py
@@ -1,13 +1,21 @@
 import pytest
+from functools import partial
 
 
 def test_raises(should):
     def error():
         raise AssertionError('foo')
 
+    def error_with_params(foo_param):
+        raise AssertionError(foo_param)
+
     error | should.raise_error(AssertionError)
     error | should.do_not.raise_error(NotImplementedError)
 
+    partial(error_with_params, "Foobar") | should.raise_error(AssertionError)
+    partial(error_with_params, "Foobar") | should.to_not\
+        .raise_error(NotImplementedError)
+
     with pytest.raises(AssertionError):
         error | should.raise_error(NotImplementedError)