Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9124463
D7372.id26678.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D7372.id26678.diff
View Options
diff --git a/swh/model/model.py b/swh/model/model.py
--- a/swh/model/model.py
+++ b/swh/model/model.py
@@ -289,8 +289,8 @@
object_type: Final = "person"
fullname = attr.ib(type=bytes, validator=type_validator())
- name = attr.ib(type=Optional[bytes], validator=type_validator())
- email = attr.ib(type=Optional[bytes], validator=type_validator())
+ name = attr.ib(type=Optional[bytes], validator=type_validator(), eq=False)
+ email = attr.ib(type=Optional[bytes], validator=type_validator(), eq=False)
@classmethod
def from_fullname(cls, fullname: bytes):
diff --git a/swh/model/tests/test_model.py b/swh/model/tests/test_model.py
--- a/swh/model/tests/test_model.py
+++ b/swh/model/tests/test_model.py
@@ -646,6 +646,18 @@
assert expected_person == Person.from_fullname(person)
+def test_person_comparison():
+ """Check only the fullname attribute is used to compare Person objects
+
+ """
+ person = Person(fullname=b"p1", name=None, email=None)
+ assert attr.evolve(person, name=b"toto") == person
+ assert attr.evolve(person, email=b"toto@example.com") == person
+
+ person = Person(fullname=b"", name=b"toto", email=b"toto@example.com")
+ assert attr.evolve(person, fullname=b"dude") != person
+
+
# Content
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jun 20, 7:09 PM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3225660
Attached To
D7372: Exclude name and email attributes from People comparison
Event Timeline
Log In to Comment