MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_set_emulates

Method test_set_emulates

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

Source from the content-addressed store, hash-verified

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