@@ -114,23 +114,23 @@ def edit_root(self) -> Generator[Root, None, None]:
114114 """Context manager for editing root metadata. See edit()"""
115115 with self .edit (Root .type ) as root :
116116 if not isinstance (root , Root ):
117- raise RuntimeError ("Unexpected root type" )
117+ raise AssertionError ("Unexpected root type" )
118118 yield root
119119
120120 @contextmanager
121121 def edit_timestamp (self ) -> Generator [Timestamp , None , None ]:
122122 """Context manager for editing timestamp metadata. See edit()"""
123123 with self .edit (Timestamp .type ) as timestamp :
124124 if not isinstance (timestamp , Timestamp ):
125- raise RuntimeError ("Unexpected timestamp type" )
125+ raise AssertionError ("Unexpected timestamp type" )
126126 yield timestamp
127127
128128 @contextmanager
129129 def edit_snapshot (self ) -> Generator [Snapshot , None , None ]:
130130 """Context manager for editing snapshot metadata. See edit()"""
131131 with self .edit (Snapshot .type ) as snapshot :
132132 if not isinstance (snapshot , Snapshot ):
133- raise RuntimeError ("Unexpected snapshot type" )
133+ raise AssertionError ("Unexpected snapshot type" )
134134 yield snapshot
135135
136136 @contextmanager
@@ -140,35 +140,35 @@ def edit_targets(
140140 """Context manager for editing targets metadata. See edit()"""
141141 with self .edit (rolename ) as targets :
142142 if not isinstance (targets , Targets ):
143- raise RuntimeError (f"Unexpected targets ({ rolename } ) type" )
143+ raise AssertionError (f"Unexpected targets ({ rolename } ) type" )
144144 yield targets
145145
146146 def root (self ) -> Root :
147147 """Read current root metadata"""
148148 root = self .open (Root .type ).signed
149149 if not isinstance (root , Root ):
150- raise RuntimeError ("Unexpected root type" )
150+ raise AssertionError ("Unexpected root type" )
151151 return root
152152
153153 def timestamp (self ) -> Timestamp :
154154 """Read current timestamp metadata"""
155155 timestamp = self .open (Timestamp .type ).signed
156156 if not isinstance (timestamp , Timestamp ):
157- raise RuntimeError ("Unexpected timestamp type" )
157+ raise AssertionError ("Unexpected timestamp type" )
158158 return timestamp
159159
160160 def snapshot (self ) -> Snapshot :
161161 """Read current snapshot metadata"""
162162 snapshot = self .open (Snapshot .type ).signed
163163 if not isinstance (snapshot , Snapshot ):
164- raise RuntimeError ("Unexpected snapshot type" )
164+ raise AssertionError ("Unexpected snapshot type" )
165165 return snapshot
166166
167167 def targets (self , rolename : str = Targets .type ) -> Targets :
168168 """Read current targets metadata"""
169169 targets = self .open (rolename ).signed
170170 if not isinstance (targets , Targets ):
171- raise RuntimeError ("Unexpected targets type" )
171+ raise AssertionError ("Unexpected targets type" )
172172 return targets
173173
174174 def do_snapshot (
0 commit comments