Skip to content

Commit

Permalink
Linter appeasement
Browse files Browse the repository at this point in the history
  • Loading branch information
ramo-j committed Jul 25, 2024
1 parent 64c9b09 commit 35920f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
4 changes: 3 additions & 1 deletion tests/cli/main_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def testToolWithArbitraryRecipe(self):

@parameterized.named_parameters(_EnumerateRecipeNames())
def testRecipeSetupArgs(self, recipe_name):
"""Parameterised version of _testRecipeSetupArgs."""
self._testRecipeSetupArgs(recipe_name)

def _testRecipeSetupArgs(self, recipe_name):
Expand Down Expand Up @@ -132,6 +133,7 @@ def _testRecipeSetupArgs(self, recipe_name):

@parameterized.named_parameters(_EnumerateRecipeNames())
def testRecipeValidators(self, recipe_name):
"""Parameterised version of _testRecipeValidators."""
self._testRecipeValidators(recipe_name)

def _testRecipeValidators(self, recipe_name):
Expand All @@ -153,7 +155,7 @@ def _testRecipeValidators(self, recipe_name):
validators_manager.ValidatorsManager.ListValidators(),
f'Error in {recipe.name}:{arg.switch} - '
f'Invalid validator {arg.validation_params["format"]}.')

if test_params:
self.tool.ValidateArguments()

Expand Down
22 changes: 11 additions & 11 deletions tests/lib/validators/integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ def testInit(self):
('fivemill', '5000000', 5000000),
('minusfive', '-5', -5),
)
def testValidateSuccess(self, input, expected):
def testValidateSuccess(self, in_param, expected):
"""Test that correct values do not throw an exception."""
result = self.validator.Validate(input, self.recipe_argument)
result = self.validator.Validate(in_param, self.recipe_argument)
self.assertEqual(result, expected)

def testValidateFailure(self):
@parameterized.named_parameters(
('str', 'foo'),
('float', '5.5')
)
def testValidateFailure(self, in_param):
"""Test integer test failure."""
values = ['foo', '5.5']

for value in values:
with self.assertRaisesRegex(
errors.RecipeArgsValidationFailure,
'Not a valid integer'):
self.validator.Validate(value, self.recipe_argument)
with self.assertRaisesRegex(
errors.RecipeArgsValidationFailure,
'Not a valid integer'):
self.validator.Validate(in_param, self.recipe_argument)


if __name__ == '__main__':
absltest.main()

0 comments on commit 35920f4

Please sign in to comment.