Skip to content

Commit 41d044a

Browse files
committed
tests - test saving
1 parent 1155a1e commit 41d044a

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

‎tests/test_main.py‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import io
22
import os
33

4-
import UnityPy
54
from PIL import Image
65

6+
import UnityPy
7+
78
SAMPLES = os.path.join(os.path.dirname(os.path.abspath(__file__)), "samples")
89

910

@@ -20,6 +21,24 @@ def test_read_batch():
2021
obj.read()
2122

2223

24+
def test_save_dict():
25+
env = UnityPy.load(SAMPLES)
26+
for obj in env.objects:
27+
data = obj.get_raw_data()
28+
item = obj.read_typetree(wrap=False)
29+
re_data = obj.save_typetree(item)
30+
assert data == re_data
31+
32+
33+
def test_save_wrap():
34+
env = UnityPy.load(SAMPLES)
35+
for obj in env.objects:
36+
data = obj.get_raw_data()
37+
item = obj.read_typetree(wrap=True)
38+
re_data = obj.save_typetree(item)
39+
assert data == re_data
40+
41+
2342
def test_texture2d():
2443
for f in os.listdir(SAMPLES):
2544
env = UnityPy.load(os.path.join(SAMPLES, f))

0 commit comments

Comments
 (0)