MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_set_duck

Method test_set_duck

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

Source from the content-addressed store, hash-verified

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