diff --git a/README.rst b/README.rst index 74f513c..f83774c 100644 --- a/README.rst +++ b/README.rst @@ -40,16 +40,3 @@ A nice example of exceptions would be:: ... ShouldNotSatisfied: 'should' does include 'oul' - - -All Should-DSL releases **before 2.0** uses a deprecated style, although we still support this old style, it will be dropped soon and we discourage you to use that style. Old style usage like:: - - >>> 3 |should_not.equal_to| 2.99 - -should be written as:: - - >>> 3 |should_not| equal_to(2.99) - - -This new syntax for writing expectations has been changed because the requirement to have a single "right value" had been a limition to write new matchers and add other enhancements to Should-DSL and you should update the code that uses old style, because we plan to remove them soon. - diff --git a/should_dsl/doctests/deprecated.txt b/should_dsl/doctests/deprecated.txt index 38d4354..77ebff7 100644 --- a/should_dsl/doctests/deprecated.txt +++ b/should_dsl/doctests/deprecated.txt @@ -4,5 +4,5 @@ >>> @matcher ... def be_the_square_root_of(): ... return (lambda x, y: x == math.sqrt(y), "%s is %sthe square root of %s") ->>> 3 |should.be_the_square_root_of| 9 +>>> 3 |should| be_the_square_root_of(9) diff --git a/should_dsl/doctests/drop_deprecated_features.txt b/should_dsl/doctests/drop_deprecated_features.txt index 54eb1c4..b3ff4b5 100644 --- a/should_dsl/doctests/drop_deprecated_features.txt +++ b/should_dsl/doctests/drop_deprecated_features.txt @@ -21,3 +21,9 @@ Traceback (most recent call last): ... NameError: name 'should_not_have' is not defined + +>>> "Brasil" |should.end_with| "sil" +Traceback (most recent call last): + ... +AttributeError: ... + diff --git a/should_dsl/doctests/missing_method.txt b/should_dsl/doctests/missing_method.txt deleted file mode 100644 index 5d475f7..0000000 --- a/should_dsl/doctests/missing_method.txt +++ /dev/null @@ -1,7 +0,0 @@ ->>> from should_dsl import * - ->>> 10 |should.be_the_maximum_of| [1, 2, 10] -Traceback (most recent call last): -... -AttributeError: Should object has no matcher 'be_the_maximum_of' - diff --git a/should_dsl/dsl.py b/should_dsl/dsl.py index 3fb9dbd..45dbf4f 100644 --- a/should_dsl/dsl.py +++ b/should_dsl/dsl.py @@ -137,24 +137,6 @@ def _put_predicate_matchers_on_namespace(self): def _get_all_public_attr_names(self, obj): return [attr_name for attr_name in dir(obj) if not attr_name.startswith('_')] - # deprecated behaviour - def __getattr__(self, method_name): - if method_name not in self._matchers_by_name: - raise AttributeError("%s object has no matcher '%s'" % ( - self.__class__.__name__, method_name)) - return self._prepare_to_receive_rvalue(method_name) - - def _prepare_to_receive_rvalue(self, method_name): - should = Should(negate=self._negate) - should._matchers_by_name = self._matchers_by_name - should._old_style_call = True - should._matcher = self._matchers_by_name[method_name] - return should - - def _convert_deprecated_style(self, rvalue): - self._rvalue = self._matcher() - self._rvalue.arg = rvalue - class _PredicateMatcher(object):