summaryrefslogtreecommitdiffstats
path: root/test/units/module_utils/json_utils
diff options
context:
space:
mode:
authorDag Wieers <dag@wieers.com>2017-05-30 19:05:19 +0200
committerJohn R Barker <john@johnrbarker.com>2017-05-30 19:05:19 +0200
commit4efec414e79b6f41caabae55027cb516c5965e9b (patch)
tree3523c0962a9f11e1b72de409a3883ca103244b9d /test/units/module_utils/json_utils
parentnxos_portchannel fix and unit test (#25019) (diff)
downloadansible-4efec414e79b6f41caabae55027cb516c5965e9b.tar.xz
ansible-4efec414e79b6f41caabae55027cb516c5965e9b.zip
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
Diffstat (limited to 'test/units/module_utils/json_utils')
-rw-r--r--test/units/module_utils/json_utils/test_filter_non_json_lines.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/test/units/module_utils/json_utils/test_filter_non_json_lines.py b/test/units/module_utils/json_utils/test_filter_non_json_lines.py
index 768e770a1e..a92e38298d 100644
--- a/test/units/module_utils/json_utils/test_filter_non_json_lines.py
+++ b/test/units/module_utils/json_utils/test_filter_non_json_lines.py
@@ -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
)