(self)
| 1745 | ) |
| 1746 | |
| 1747 | def test_object_emulates(self): |
| 1748 | class MyCollection2: |
| 1749 | __emulates__ = None |
| 1750 | |
| 1751 | def __init__(self): |
| 1752 | self.data = set() |
| 1753 | |
| 1754 | # looks like a list |
| 1755 | |
| 1756 | def append(self, item): |
| 1757 | assert False |
| 1758 | |
| 1759 | @collection.appender |
| 1760 | def push(self, item): |
| 1761 | self.data.add(item) |
| 1762 | |
| 1763 | @collection.remover |
| 1764 | def zark(self, item): |
| 1765 | self.data.remove(item) |
| 1766 | |
| 1767 | @collection.removes_return() |
| 1768 | def maybe_zark(self, item): |
| 1769 | if item in self.data: |
| 1770 | self.data.remove(item) |
| 1771 | return item |
| 1772 | |
| 1773 | @collection.iterator |
| 1774 | def __iter__(self): |
| 1775 | return iter(self.data) |
| 1776 | |
| 1777 | __hash__ = object.__hash__ |
| 1778 | |
| 1779 | def __eq__(self, other): |
| 1780 | return self.data == other |
| 1781 | |
| 1782 | self._test_adapter(MyCollection2) |
| 1783 | self._test_object(MyCollection2) |
| 1784 | self.assert_( |
| 1785 | getattr(MyCollection2, "_sa_instrumented") == id(MyCollection2) |
| 1786 | ) |
| 1787 | |
| 1788 | def test_recipes(self): |
| 1789 | class Custom: |
nothing calls this directly
no test coverage detected