♻️ Refactor project structure by removing scattered Python test scripts
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Person(BaseModel):
|
||||
name: str
|
||||
age: int
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
x = '{"name": "hatter", "age": 18}'
|
||||
p = Person.model_validate_json(x)
|
||||
z = p.model_dump_json(indent=4)
|
||||
print(x)
|
||||
print(p)
|
||||
print(z)
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
|
||||
if __name__ == "__main__":
|
||||
x = '{"name": "hatter", "age": 18}'
|
||||
y = json.loads(x)
|
||||
z = json.dumps(y, indent=4, sort_keys=True)
|
||||
print(x)
|
||||
print(y)
|
||||
print(z)
|
||||
Reference in New Issue
Block a user