@@ -613,6 +613,15 @@ def test_equality_and_hash_without_condition(self):
613613 assert hash (entry1 ) == hash (entry2 )
614614 assert hash (entry1 ) != hash (entry3 ) # Usually true
615615
616+ def test_equality_and_hash_from_api_repr (self ):
617+ """Compare equal entries where one was created via from_api_repr."""
618+ entry1 = AccessEntry ("OWNER" , "specialGroup" , "projectOwners" )
619+ entry2 = AccessEntry .from_api_repr (
620+ {"role" : "OWNER" , "specialGroup" : "projectOwners" }
621+ )
622+ assert entry1 == entry2
623+ assert hash (entry1 ) == hash (entry2 )
624+
616625 def test_equality_and_hash_with_condition (self , condition_1 , condition_2 ):
617626 cond1a = Condition (
618627 condition_1 .expression , condition_1 .title , condition_1 .description
@@ -746,6 +755,13 @@ def test_dataset_property_with_condition(self, condition_1):
746755 assert "dataset" in entry ._properties
747756 assert "condition" in entry ._properties
748757
758+ def test_repr_from_api_repr (self ):
759+ """Check that repr() includes the correct entity_type when the object is initialized from a dictionary."""
760+ api_repr = {"role" : "OWNER" , "userByEmail" : "owner@example.com" }
761+ entry = AccessEntry .from_api_repr (api_repr )
762+ entry_str = repr (entry )
763+ assert entry_str == "<AccessEntry: role=OWNER, userByEmail=owner@example.com>"
764+
749765
750766class TestDatasetReference (unittest .TestCase ):
751767 @staticmethod
0 commit comments