import os
import json
import pytest
from app.core.render_engine import PythonRenderEngine

def test_render_engine_init():
    engine = PythonRenderEngine()
    assert engine.sample_rate == 44100

def test_bars_to_samples():
    engine = PythonRenderEngine()
    samples = engine.bars_to_samples(4.0, 120.0, 4)
    assert samples == 352800

def test_render_session_container_empty():
    engine = PythonRenderEngine()
    session = {"tracks": []}
    buf = engine.render_session_container(session, {}, 120.0, 4, 1000)
    assert buf.shape == (2, 1000)
    assert (buf == 0.0).all()
