File size: 1,006 Bytes
4b7d391
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40900ed
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""Tests for Gradio app construction."""

from pathlib import Path

import pytest

gradio = pytest.importorskip("gradio")


def test_architecture_html_exists():
    path = Path(__file__).parent.parent / "architecture.html"
    assert path.exists(), "architecture.html not found"
    content = path.read_text()
    assert "lmaf-arch" in content
    assert "<script>" in content
    assert "d3" in content


def test_architecture_html_is_valid_document():
    path = Path(__file__).parent.parent / "architecture.html"
    content = path.read_text()
    assert content.strip().startswith("<!DOCTYPE html>")
    assert "</html>" in content


def test_app_builds():
    import app
    demo = app.build_app()
    assert demo is not None


def test_app_has_iframe_srcdoc():
    import app
    assert "iframe" in app.ARCHITECTURE_HTML
    assert "srcdoc" in app.ARCHITECTURE_HTML


def test_stream_chat_is_async_generator():
    import app
    import inspect
    assert inspect.isasyncgenfunction(app.stream_chat)