MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_set_duck

Method test_set_duck

test/orm/test_collection.py:1127–1162  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1125 self.assert_(getattr(MySet, "_sa_instrumented") == id(MySet))
1126
1127 def test_set_duck(self):
1128 class SetLike:
1129 def __init__(self):
1130 self.data = set()
1131
1132 def add(self, item):
1133 self.data.add(item)
1134
1135 def remove(self, item):
1136 self.data.remove(item)
1137
1138 def discard(self, item):
1139 self.data.discard(item)
1140
1141 def clear(self):
1142 self.data.clear()
1143
1144 def pop(self):
1145 return self.data.pop()
1146
1147 def update(self, other):
1148 self.data.update(other)
1149
1150 def __iter__(self):
1151 return iter(self.data)
1152
1153 __hash__ = object.__hash__
1154
1155 def __eq__(self, other):
1156 return self.data == other
1157
1158 self._test_adapter(SetLike)
1159 self._test_set(SetLike)
1160 self._test_set_bulk(SetLike)
1161 self._test_set_dataclasses(SetLike)
1162 self.assert_(getattr(SetLike, "_sa_instrumented") == id(SetLike))
1163
1164 def test_set_emulates(self):
1165 class SetIsh:

Callers

nothing calls this directly

Calls 5

_test_adapterMethod · 0.95
_test_setMethod · 0.95
_test_set_bulkMethod · 0.95
_test_set_dataclassesMethod · 0.95
assert_Method · 0.45

Tested by

no test coverage detected