예제 #1
0
    def _alias_result(self):
        """Alias `solutions` and `num_occurrences`.

        Deprecated in version 0.8.0.
        """
        if not self._result:
            return

        msg = "'{}' alias has been deprecated in favor of '{}'"
        samples_msg = msg.format('samples', 'solutions')
        occurrences_msg = msg.format('occurrences', 'num_occurrences')

        aliases = dict(samples=deprecated(samples_msg)(
            itemgetter('solutions')),
                       occurrences=deprecated(occurrences_msg)(
                           itemgetter('num_occurrences')))

        self._result = aliasdict(self._result)
        self._result.alias(aliases)

        return self._result
예제 #2
0
 def test_decorator(self):
     with self.assertRaises(TypeError):
         deprecated()("not-a-function")