Skip to content

Commit

Permalink
Track asset files as well
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinXPN committed Aug 31, 2023
1 parent 62920b2 commit 02dc2ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions sync/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def truncate(x, max_len: int = 100):
if x.input_files is not None else None,
target_files={filename: content[: max_len] for filename, content in x.target_files.items()}
if x.target_files is not None else None,
input_assets={filename: content[: max_len] for filename, content in x.input_assets.items()}
if x.input_assets is not None else None,
target_assets={filename: content[: max_len] for filename, content in x.target_assets.items()}
if x.target_assets is not None else None,
)

if isinstance(x, list):
Expand Down
12 changes: 10 additions & 2 deletions tests/unit/sync/test_truncation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import base64

import pytest

from models import TestCase
Expand All @@ -8,8 +10,14 @@ class TestTruncation:
@classmethod
def _get_tests_with_len(cls, char_count: int) -> list[TestCase]:
data = 'a' * char_count
test = TestCase(input=data, target=data, input_files={'test.txt': data}, target_files={'res-test.txt': data})
return [test for _ in range(3)]
binary = base64.b64encode(b'a' * char_count)
binary = binary.decode('utf-8')[: char_count]

return [TestCase(
input=data, target=data,
input_files={'test.txt': data}, target_files={'res-test.txt': data},
input_assets={'test.bin': binary}, target_assets={'res-test.bin': binary},
) for _ in range(3)]

def test_truncated_tests(self):
tests = self._get_tests_with_len(120)
Expand Down

0 comments on commit 02dc2ee

Please sign in to comment.