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

Method test_set_emulates

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

Source from the content-addressed store, hash-verified

1162 self.assert_(getattr(SetLike, "_sa_instrumented") == id(SetLike))
1163
1164 def test_set_emulates(self):
1165 class SetIsh:
1166 __emulates__ = set
1167
1168 def __init__(self):
1169 self.data = set()
1170
1171 def add(self, item):
1172 self.data.add(item)
1173
1174 def remove(self, item):
1175 self.data.remove(item)
1176
1177 def discard(self, item):
1178 self.data.discard(item)
1179
1180 def pop(self):
1181 return self.data.pop()
1182
1183 def update(self, other):
1184 self.data.update(other)
1185
1186 def __iter__(self):
1187 return iter(self.data)
1188
1189 def clear(self):
1190 self.data.clear()
1191
1192 __hash__ = object.__hash__
1193
1194 def __eq__(self, other):
1195 return self.data == other
1196
1197 self._test_adapter(SetIsh)
1198 self._test_set(SetIsh)
1199 self._test_set_bulk(SetIsh)
1200 self._test_set_dataclasses(SetIsh)
1201 self.assert_(getattr(SetIsh, "_sa_instrumented") == id(SetIsh))
1202
1203 def _test_dict_wo_mutation(self, typecallable, creator=None):
1204 if creator is None:

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