mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-23 02:47:10 +00:00
<type>(scope): <description>
[body] [footer(s)]
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import unittest
|
||||
|
||||
from apps.task.tasks import analyze_data_task
|
||||
|
||||
|
||||
class TestAnalyzeDataTask(unittest.TestCase):
|
||||
def test_task_execution_basic(self):
|
||||
code_str = 'print("Hello, World!")'
|
||||
result_path = "stdout"
|
||||
expected_bytes = b"Hello, World!\n"
|
||||
result = analyze_data_task(code_str, result_path, expected_bytes)
|
||||
self.assertTrue(result["success"])
|
||||
self.assertTrue(result["match"])
|
||||
|
||||
def test_task_execution_with_files(self):
|
||||
code_str = """
|
||||
with open("file.txt") as f:
|
||||
print(f.read())
|
||||
"""
|
||||
result_path = "stdout"
|
||||
expected_bytes = b"some_content\n"
|
||||
result = analyze_data_task(
|
||||
code_str,
|
||||
result_path,
|
||||
expected_bytes,
|
||||
input_files=[{"bind_at": "file.txt", "content": b"some_content"}],
|
||||
)
|
||||
print(result)
|
||||
self.assertTrue(result["success"])
|
||||
self.assertTrue(result["match"])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user