mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-02 23:31:25 -07:00
test/: PEP8 compliancy (#24803)
* test/: PEP8 compliancy - Make PEP8 compliant * Python3 chokes on casting int to bytes (#24952) But if we tell the formatter that the var is a number, it works
This commit is contained in:
parent
31c59ad5f9
commit
4efec414e7
110 changed files with 1702 additions and 1547 deletions
|
@ -22,11 +22,12 @@ __metaclass__ = type
|
|||
|
||||
import json
|
||||
|
||||
from ansible.compat.tests import unittest
|
||||
from nose.tools import eq_, raises
|
||||
|
||||
from ansible.compat.tests import unittest
|
||||
from ansible.module_utils.json_utils import _filter_non_json_lines
|
||||
|
||||
|
||||
class TestAnsibleModuleExitJson(unittest.TestCase):
|
||||
single_line_json_dict = u"""{"key": "value", "olá": "mundo"}"""
|
||||
single_line_json_array = u"""["a","b","c"]"""
|
||||
|
@ -38,10 +39,12 @@ class TestAnsibleModuleExitJson(unittest.TestCase):
|
|||
"b",
|
||||
"c"]"""
|
||||
|
||||
all_inputs = [single_line_json_dict,
|
||||
single_line_json_array,
|
||||
multi_line_json_dict,
|
||||
multi_line_json_array]
|
||||
all_inputs = [
|
||||
single_line_json_dict,
|
||||
single_line_json_array,
|
||||
multi_line_json_dict,
|
||||
multi_line_json_array
|
||||
]
|
||||
|
||||
junk = [u"single line of junk", u"line 1/2 of junk\nline 2/2 of junk"]
|
||||
|
||||
|
@ -51,7 +54,7 @@ class TestAnsibleModuleExitJson(unittest.TestCase):
|
|||
u'{"No json": "ending"',
|
||||
u'{"wrong": "ending"]',
|
||||
u'["wrong": "ending"}',
|
||||
)
|
||||
)
|
||||
|
||||
def test_just_json(self):
|
||||
for i in self.all_inputs:
|
||||
|
@ -82,7 +85,8 @@ class TestAnsibleModuleExitJson(unittest.TestCase):
|
|||
|
||||
def test_unparsable_filter_non_json_lines(self):
|
||||
for i in self.unparsable_cases:
|
||||
self.assertRaises(ValueError,
|
||||
self.assertRaises(
|
||||
ValueError,
|
||||
lambda data: _filter_non_json_lines(data),
|
||||
data=i
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue