diff options
author | Thanh Ha <zxiiro@gmail.com> | 2019-08-23 09:14:39 -0400 |
---|---|---|
committer | Sorin Sbarnea <ssbarnea@redhat.com> | 2019-09-09 19:23:24 +0100 |
commit | 4d90c187a945c04b9949d5ee7738a049dd634897 (patch) | |
tree | 106bf6e05ad1f2260823e7cd68651b535b8ac3ef /tests/errors/test_exceptions.py | |
parent | ead185134d8aa5d3d0974207356de6c4fdb2e6e8 (diff) | |
download | python-jenkins-job-builder-4d90c187a945c04b9949d5ee7738a049dd634897.tar.gz python-jenkins-job-builder-4d90c187a945c04b9949d5ee7738a049dd634897.tar.xz python-jenkins-job-builder-4d90c187a945c04b9949d5ee7738a049dd634897.zip |
Auto-generated output from python-black
Please review the following patch containing the code changes in
the repo. This patch is a transition patch and is the auto-generated
output of the python-black tool.
Change-Id: I2d2de71da8a105fb62b561899ae78441ddab4032
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
Diffstat (limited to 'tests/errors/test_exceptions.py')
-rw-r--r-- | tests/errors/test_exceptions.py | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/tests/errors/test_exceptions.py b/tests/errors/test_exceptions.py index 2fba25a6..079a5406 100644 --- a/tests/errors/test_exceptions.py +++ b/tests/errors/test_exceptions.py @@ -16,19 +16,19 @@ def dispatch(exc, *args): def gen_xml(exc, *args): - data = {'module': 'data'} # noqa + data = {"module": "data"} # noqa raise exc(*args) class TestInvalidAttributeError(base.BaseTestCase): - def test_no_valid_values(self): # When given no valid values, InvalidAttributeError simply displays a # message indicating the invalid value, the component type, the # component name, and the attribute name. message = "'{0}' is an invalid value for attribute {1}.{2}".format( - "fnord", "type.name", "fubar") + "fnord", "type.name", "fubar" + ) with ExpectedException(errors.InvalidAttributeError, message): dispatch(errors.InvalidAttributeError, "fubar", "fnord") @@ -37,46 +37,49 @@ class TestInvalidAttributeError(base.BaseTestCase): # indicating the invalid value, the component type, the component name, # and the attribute name; additionally, it lists the valid values for # the current component type & name. - valid_values = ['herp', 'derp'] + valid_values = ["herp", "derp"] message = "'{0}' is an invalid value for attribute {1}.{2}".format( - "fnord", "type.name", "fubar") + "fnord", "type.name", "fubar" + ) message += "\nValid values include: {0}".format( - ', '.join("'{0}'".format(value) for value in valid_values)) + ", ".join("'{0}'".format(value) for value in valid_values) + ) with ExpectedException(errors.InvalidAttributeError, message): - dispatch(errors.InvalidAttributeError, "fubar", "fnord", - valid_values) + dispatch(errors.InvalidAttributeError, "fubar", "fnord", valid_values) class TestMissingAttributeError(base.BaseTestCase): - def test_with_single_missing_attribute(self): # When passed a single missing attribute, display a message indicating # * the missing attribute # * which component type and component name is missing it. - missing_attribute = 'herp' + missing_attribute = "herp" message = "Missing {0} from an instance of '{1}'".format( - missing_attribute, 'type.name') + missing_attribute, "type.name" + ) with ExpectedException(errors.MissingAttributeError, message): dispatch(errors.MissingAttributeError, missing_attribute) - with ExpectedException(errors.MissingAttributeError, - message.replace('type.name', 'module')): + with ExpectedException( + errors.MissingAttributeError, message.replace("type.name", "module") + ): gen_xml(errors.MissingAttributeError, missing_attribute) def test_with_multiple_missing_attributes(self): # When passed multiple missing attributes, display a message indicating # * the missing attributes # * which component type and component name is missing it. - missing_attribute = ['herp', 'derp'] + missing_attribute = ["herp", "derp"] message = "One of {0} must be present in '{1}'".format( - ', '.join("'{0}'".format(value) for value in missing_attribute), - 'type.name') + ", ".join("'{0}'".format(value) for value in missing_attribute), "type.name" + ) with ExpectedException(errors.MissingAttributeError, message): dispatch(errors.MissingAttributeError, missing_attribute) - with ExpectedException(errors.MissingAttributeError, - message.replace('type.name', 'module')): + with ExpectedException( + errors.MissingAttributeError, message.replace("type.name", "module") + ): gen_xml(errors.MissingAttributeError, missing_attribute) |