description.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. __author__ = "Jon Reid"
  2. __copyright__ = "Copyright 2011 hamcrest.org"
  3. __license__ = "BSD, see License.txt"
  4. class Description(object):
  5. """A description of a :py:class:`~hamcrest.core.matcher.Matcher`.
  6. A :py:class:`~hamcrest.core.matcher.Matcher` will describe itself to a
  7. description which can later be used for reporting.
  8. """
  9. def append_text(self, text):
  10. """Appends some plain text to the description.
  11. :returns: ``self``, for chaining
  12. """
  13. raise NotImplementedError('append_text')
  14. def append_description_of(self, value):
  15. """Appends description of given value to this description.
  16. If the value implements
  17. :py:meth:`~hamcrest.core.selfdescribing.SelfDescribing.describe_to`,
  18. then it will be used.
  19. :returns: ``self``, for chaining
  20. """
  21. raise NotImplementedError('append_description_of')
  22. def append_value(self, value):
  23. """Appends an arbitary value to the description.
  24. **Deprecated:** Call
  25. :py:meth:`~hamcrest.core.description.Description.append_description_of`
  26. instead.
  27. :returns: ``self``, for chaining
  28. """
  29. raise NotImplementedError('append_value')
  30. def append_list(self, start, separator, end, list):
  31. """Appends a list of objects to the description.
  32. :param start: String that will begin the list description.
  33. :param separator: String that will separate each object in the
  34. description.
  35. :param end: String that will end the list description.
  36. :param list: List of objects to be described.
  37. :returns: ``self``, for chaining
  38. """
  39. raise NotImplementedError('append_list')