Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/test_json_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import pytest
from json_memory import Memory, Synapse, Schema, WeightGate, compress, decompress, savings_report
from json_memory.compress import minify

# -- Memory Tests --------------------------------------------------

Expand Down Expand Up @@ -435,6 +436,17 @@ def test_decompress_roundtrip(self):
decompressed = decompress(compressed)
assert decompressed == original


def test_minify(self):
json_str = '{\n "key": "value",\n "hello": "world"\n}'
minified = minify(json_str)
assert minified == '{"key":"value","hello":"world"}'

# Test ensure_ascii=False
json_with_unicode = '{\n "key": "✓"\n}'
minified_unicode = minify(json_with_unicode)
assert minified_unicode == '{"key":"✓"}'

def test_savings_report(self):
report = savings_report("hello world", "hw")
assert report["original_chars"] == 11
Expand Down