| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -141,9 +141,7 @@ def test_options_service_config(fs): | |||
| 141 | 141 | ||
| 142 | 142 | ||
| 143 | 143 | def test_options_bool_flags(): | |
| 144 | - # All these options are default False. | ||
| 145 | - # If new options violate this assumption, | ||
| 146 | - # this test may need to be tweaked. | ||
| 144 | + # Most options are default False. | ||
| 147 | 145 | # New options should follow the dash-case/snake_case convention. | |
| 148 | 146 | opt_str_to_attr_name = { | |
| 149 | 147 | name: re.sub(r"-", "_", name) | |
@@ -161,3 +159,22 @@ def test_options_bool_flags(): | |||
| 161 | 159 | ||
| 162 | 160 | options = Options.build(opt) | |
| 163 | 161 | assert getattr(options, attr) | |
| 162 | + | ||
| 163 | + # Check autogen-snippets separately, as it is default True | ||
| 164 | + options = Options.build("") | ||
| 165 | + assert options.autogen_snippets | ||
| 166 | + | ||
| 167 | + options = Options.build("autogen-snippets=False") | ||
| 168 | + assert not options.autogen_snippets | ||
| 169 | + | ||
| 170 | + | ||
| 171 | + def test_options_autogen_snippets_false_for_old_naming(): | ||
| 172 | + # NOTE: Snippets are not currently correct for the alternative (Ads) templates | ||
| 173 | + # so always disable snippetgen in that case | ||
| 174 | + # https://github.com/googleapis/gapic-generator-python/issues/1052 | ||
| 175 | + options = Options.build("old-naming") | ||
| 176 | + assert not options.autogen_snippets | ||
| 177 | + | ||
| 178 | + # Even if autogen-snippets is set to True, do not enable snippetgen | ||
| 179 | + options = Options.build("old-naming,autogen-snippets=True") | ||
| 180 | + assert not options.autogen_snippets | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments