24 lines
608 B
Python
24 lines
608 B
Python
import unittest
|
|
|
|
from dumas_json_nodes import DumasJSONStringToObjectNode
|
|
|
|
|
|
class DumasJSONStringToObjectNodeTests(unittest.TestCase):
|
|
def test_parses_valid_json(self):
|
|
node = DumasJSONStringToObjectNode()
|
|
|
|
result = node.convert_string_to_json('{"name":"Dumas","count":2}')
|
|
|
|
self.assertEqual(result, ({"name": "Dumas", "count": 2},))
|
|
|
|
def test_returns_none_for_invalid_json(self):
|
|
node = DumasJSONStringToObjectNode()
|
|
|
|
result = node.convert_string_to_json('{"name":')
|
|
|
|
self.assertEqual(result, (None,))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|