Changeset View
Changeset View
Standalone View
Standalone View
swh/dataset/test/test_edges.py
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | TEST_ORIGIN_VISIT_STATUS = { | ||||
"status": "ongoing", # TODO | "status": "ongoing", # TODO | ||||
"metadata": {"foo": "bar"}, | "metadata": {"foo": "bar"}, | ||||
} | } | ||||
class FakeDiskSet(set): | class FakeDiskSet(set): | ||||
""" | """ | ||||
A set with an add() method that returns whether the item has been added | A set with an add() method that returns whether the item has been added | ||||
or was already there. Used to replace SQLiteSet in unittests. | or was already there. Used to replace disk sets in unittests. | ||||
""" | """ | ||||
def add(self, v): | def add(self, v): | ||||
assert isinstance(v, bytes) | assert isinstance(v, bytes) | ||||
r = True | r = True | ||||
if v in self: | if v in self: | ||||
r = False | r = False | ||||
super().add(v) | super().add(v) | ||||
▲ Show 20 Lines • Show All 490 Lines • Show Last 20 Lines |