Changeset View
Changeset View
Standalone View
Standalone View
swh/model/tests/test_hypothesis_strategies.py
Show All 12 Lines | |||||
from swh.model.hypothesis_strategies import ( | from swh.model.hypothesis_strategies import ( | ||||
aware_datetimes, | aware_datetimes, | ||||
objects, | objects, | ||||
object_dicts, | object_dicts, | ||||
contents, | contents, | ||||
skipped_contents, | skipped_contents, | ||||
snapshots, | snapshots, | ||||
origin_visits, | origin_visits, | ||||
persons, | |||||
) | ) | ||||
from swh.model.model import TargetType | from swh.model.model import TargetType | ||||
target_types = ("content", "directory", "revision", "release", "snapshot", "alias") | target_types = ("content", "directory", "revision", "release", "snapshot", "alias") | ||||
all_but_skipped_content = ( | all_but_skipped_content = ( | ||||
"origin", | "origin", | ||||
"origin_visit", | "origin_visit", | ||||
▲ Show 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | |||||
@settings(max_examples=1) | @settings(max_examples=1) | ||||
def test_snapshots_strategy_fixed_size(snapshot): | def test_snapshots_strategy_fixed_size(snapshot): | ||||
assert len(snapshot.branches) == _min_snp_size | assert len(snapshot.branches) == _min_snp_size | ||||
@given(origin_visits()) | @given(origin_visits()) | ||||
def test_origin_visit_aware_datetime(visit): | def test_origin_visit_aware_datetime(visit): | ||||
assert visit.date.tzinfo is not None | assert visit.date.tzinfo is not None | ||||
@given(persons()) | |||||
def test_person_do_not_look_like_anonimized(person): | |||||
assert not ( | |||||
len(person.fullname) == 32 and person.name is None and person.email is None | |||||
) |