from lib import Serializer as ser import json serializer = ser.Serializer("JSON") yserializer = ser.Serializer("Yaml") pserializer = ser.Serializer("PICKLE") tserializer = ser.Serializer("TOML") globala = "HI" class MetaS(type): def __new__(cls, *args): obj = super(cls, cls).__new__(cls, *args) return obj class Parent: def _getAttreasdasd(self): print(globala + "Asdas") class ClassA(Parent,metaclass=MetaS): a = range def __init__(self): self.dict = {"asd": 1} def wrapper_(func): def wrap(): print("boo!!!!") return func() return wrap
from lib import Serializer from tests.sample_objects import * import math ser = Serializer.Serializer() ser.change_form('toml') class TestPrimesJson: def test_tuple(self): ser.string = '{".list": [1, 2, 3], ".collection_type": "tuple"}' assert ser.loads(ser.string) == sample_tuple def test_int(self): ser.string = '123445' assert ser.loads(ser.string) == sample_int def test_float(self): ser.string = '0.42' assert math.isclose(ser.loads(ser.string), sample_float) def test_bool(self): ser.string = 'true' assert ser.loads(ser.string) == sample_bool def test_string(self): ser.string = '"abacaba"' assert ser.loads(ser.string) == sample_string
from lib import Serializer as ser serializer = ser.Serializer() serializer.load("sample.json") serializer.data() serializer.load("lambda.json") serializer.data("Name Asd") serializer.load("class_a.json") A = serializer.data() print(A.dict)