from unittest import TestCase

from suger.data_operator import JsonUtils


class TestJsonUtils(TestCase):
    def test_serialize(self):
        user = User('neko233')
        json = JsonUtils.serialize(user)
        print(json)

    def test_deserialize(self):
        user = User('neko233')
        json = JsonUtils.serialize(user)
        userClone = JsonUtils.deserialize(json, User)
        if userClone.name == 'neko':
            print('ok')


class User:
    def __init__(self, name, age=18):
        self.name = name
        self.age = age
