File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,9 +59,9 @@ def versions(self) -> list[ViewVersion]:
5959 """Get the versions of this view."""
6060 return self .metadata .versions
6161
62- def version (self , version_id : int ) -> ViewVersion :
63- """Get the version in this view by ID."""
64- return next (version for version in self .metadata .versions if version .version_id == version_id )
62+ def version (self , version_id : int ) -> ViewVersion | None :
63+ """Get the version in this view by ID, or None if the ID cannot be found ."""
64+ return next (( version for version in self .metadata .versions if version .version_id == version_id ), None )
6565
6666 def history (self ) -> list [ViewHistoryEntry ]:
6767 """Get the version of this history view."""
Original file line number Diff line number Diff line change @@ -119,8 +119,7 @@ def test_view_versions_multiple(example_view_metadata_v1_multiple_versions: dict
119119
120120
121121def test_view_version_unknown_id (view : View ) -> None :
122- with pytest .raises (StopIteration ):
123- view .version (999 )
122+ assert not view .version (999 )
124123
125124
126125def test_view_sql_for_unknown_dialect (view : View ) -> None :
You can’t perform that action at this time.
0 commit comments