-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: populate .repo-metadata.json
from highest version
#2890
Changes from 4 commits
57f1a13
bd77781
aaf65a9
07f5172
b9611ff
c2e7b1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
# limitations under the License. | ||
import unittest | ||
|
||
from library_generation.model.gapic_config import GapicConfig | ||
from library_generation.model.library_config import LibraryConfig | ||
|
||
|
||
|
@@ -37,3 +38,29 @@ def test_get_library_returns_api_shortname(self): | |
gapic_configs=list(), | ||
) | ||
self.assertEqual("secret", library.get_library_name()) | ||
|
||
def test_get_sorted_gapic_configs_returns_correct_order(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we create a test for each of the scenario? [v1alpha1, v1], [v1, v2] etc. Because
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added unit tests to verify comparison result of two I kept this test case though. |
||
v1beta1 = GapicConfig(proto_path="google/spanner/v1beta1") | ||
v1 = GapicConfig(proto_path="google/spanner/v1") | ||
v1alpha1 = GapicConfig(proto_path="google/spanner/v1alpha") | ||
v2 = GapicConfig(proto_path="google/spanner/v2") | ||
admin_v2 = GapicConfig(proto_path="google/spanner/admin/v2") | ||
non_versioned = GapicConfig(proto_path="google/spanner/type") | ||
library = LibraryConfig( | ||
api_shortname="secret", | ||
name_pretty="", | ||
product_documentation="", | ||
api_description="", | ||
gapic_configs=[v1alpha1, v1, v2, admin_v2, non_versioned, v1beta1], | ||
) | ||
self.assertEqual( | ||
[ | ||
v2, | ||
v1, | ||
admin_v2, | ||
v1beta1, | ||
v1alpha1, | ||
non_versioned, | ||
], | ||
library.get_sorted_gapic_configs(), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit ignorant to string comparison in python. Is
v2
greater thanv1
because "2" has a higher ASCII value than "1"?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
I released that string comparison has a bug here:
v10
is smaller thanv2
. I'll change the algorithm.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.