18 lines
432 B
Python
18 lines
432 B
Python
|
import pytest
|
||
|
|
||
|
from util.validation import is_json
|
||
|
|
||
|
@pytest.mark.parametrize('string_value,expected', [
|
||
|
('{}', True),
|
||
|
('[]', True),
|
||
|
('[hello world]', False),
|
||
|
('{hello world}', False),
|
||
|
('[test] this is a test', False),
|
||
|
('hello world', False),
|
||
|
('{"hi": "there"}', True),
|
||
|
('[1, 2, 3, 4]', True),
|
||
|
('[1, 2, {"num": 3}, 4]', True),
|
||
|
])
|
||
|
def test_is_json(string_value, expected):
|
||
|
assert is_json(string_value) == expected
|