Scenery for Nagini

Programmatic tests

Status

Test Class Method/Function/Attribute Status
Nagini Class Tests
1️⃣ Nagini createManager(packages, filesToLoad, pyodideInitPath, workerPath)
Create manager with all parameters
2️⃣ Nagini waitForReady(manager)
Wait for manager to be ready
3️⃣ Nagini executeFromUrl(url, manager)
Execute from URL
4️⃣ Nagini getSupportedBackends()
Get list of supported backends
5️⃣ Nagini isBackendSupported(backend)
Check if a backend is supported
PyodideManager Class Tests
1️⃣ PyodideManager executeAsync(filename, code)
Execute code directly
2️⃣ PyodideManager executeAsync(filename, code, namespace)
Execute code with namespace functionality
3️⃣ PyodideManager executeAsync(filename, code, namespace)
namespace isolation - Verify namespace independence between executions
4️⃣ PyodideManager executionHistory
Execution history tracking
5️⃣ PyodideManager worker
Web worker instance
6️⃣ PyodideManager isReady
Ready state
7️⃣ PyodideManager packages
Package list
8️⃣ PyodideManager filesToLoad
Files to load
9️⃣ PyodideManager pyodideInitPath
Init script path
🔟 PyodideManager workerPath
Worker script path
1️⃣1️⃣ PyodideManager executeAsync(filename, code)
with input() handling - Input handling test: print → input → print with computation
Tests natural input flow where inputs are queued and consumed during execution
1️⃣2️⃣ PyodideManager executeAsync(filename, code)
with matplotlib figure capture - Matplotlib figure capture test: create plot and capture as base64
Tests that matplotlib figures are captured and returned as base64 strings
1️⃣3️⃣ PyodideManager fs(operation, params)
filesystem operations - Test mkdir, writeFile, readFile, exists, listdir operations
Tests complete filesystem interface functionality
BrythonManager Class Tests
1️⃣ BrythonManager executeAsync(filename, code)
Simple stdout validation
PyodideFileLoader Class Tests
1️⃣ PyodideFileLoader loadFiles(pyodide, filesToLoad)
Load files from remote URLs into pyodide FS and import modules from them
2️⃣ PyodideFileLoader retry logic and file operations
Test file loading retry mechanism and filesystem operations
3️⃣ PyodideFileLoader error handling
Test error handling for invalid URLs and filesystem errors
PyodideIntegration Tests
1️⃣ PyodideIntegration testComplexInputData()
Complex input data scenarios: multiple inputs, validation loops, mathematical processing
2️⃣ PyodideIntegration testDataVisualizationWorkflow()
Data visualization workflow: multiple matplotlib figures, statistical analysis
2️⃣-bis PyodideIntegration testBokehCaptureWorkflow()
Bokeh capture test: verify bokeh figures are captured as JSON without rendering
Tests the capture system works without BokehJS libraries loaded
3️⃣ PyodideIntegration testFileSystemAndImportWorkflow()
Filesystem and import workflow: create Python modules dynamically and import them
4️⃣ PyodideIntegration testMixedExecutionScenarios()
Mixed execution scenarios: global and namespace execution patterns
5️⃣ PyodideIntegration testAdvancedMatplotlibWorkflow()
Advanced matplotlib workflow: multiple subplots and complex visualizations
6️⃣ PyodideIntegration testMicropipPackageInstallation()
Micropip Package Installation - Test installation of a package using micropip
7️⃣ PyodideIntegration testAntlr4AndSympyInteraction()
Antlr4 and Sympy Interaction - Test parsing an expression with sympy after antlr4 import
Python Error Handling Tests
🔴 Error Handling Python Error Capture
Full traceback capture - Tests that Python errors (ZeroDivisionError, NameError, TypeError, etc.)
are properly captured with complete traceback information in stderr
ValidationUtils Class Tests
1️⃣ ValidationUtils validateArray(array, componentName)
Test array validation with valid and invalid inputs
2️⃣ ValidationUtils validateString(str, componentName)
Test string validation including empty string handling
3️⃣ ValidationUtils validateBackend(backend, componentName)
Test backend validation for pyodide, and invalid backends
4️⃣ ValidationUtils checkDangerousPatterns(code)
Test detection of dangerous Python code patterns
TestUtils Class Tests
1️⃣ TestUtils assert(condition, message)
test-utils assert function - Test the assert utility function with valid and invalid conditions
2️⃣ TestUtils assertEquals(expected, actual, message)
test-utils assertEquals function - Test the assertEquals utility with various data types
3️⃣ TestUtils assertContains(haystack, needle, message)
Test string manipulation and utility functions
Pyodide CDN Config Tests (Local/Offline Support)
1️⃣ PyodideCdnConfig test1DefaultCdnUrl()
Default CDN URL - No pyodideCdnUrl provided, uses default (backward compatibility)
2️⃣ PyodideCdnConfig test2ExplicitDefaultCdnUrl()
Explicit default URL - pyodideCdnUrl set to default value, verifies config storage
3️⃣ PyodideCdnConfig test3LocalPyodidePath()
Local Pyodide path - Custom URL for local/offline use (Capacitor/iOS apps)
4️⃣ PyodideCdnConfig test4MinimalLocalBundle()
Minimal local bundle (~18MB) - SymPy + Pydantic only (app-ready for Capacitor)
CDN Tests (jsDelivr v0.0.17)
1️⃣ CDNVersion loadFromCDN(version)
Test loading Nagini from jsDelivr CDN with version v0.0.17
2️⃣ CDNVersion basicCDNFunctionality(version)
Test basic API availability and functionality from CDN version v0.0.17
3️⃣ CDNVersion checkCDNFiles(version)
Verify all key files are accessible via CDN for version v0.0.17
4️⃣ CDNExecution executeSimpleCode(version)
Test actual Python code execution using CDN version v0.0.17
5️⃣ CDNExecution executeWithImports(version)
Test execution with standard library imports using CDN version v0.0.17
UMD Bundle Tests (v0.0.19)
1️⃣ UMD loadUMDFromCDN(version)
Test loading Nagini UMD bundle from jsDelivr CDN for universal compatibility
2️⃣ UMD umdCompatibility(version)
Test UMD bundle compatibility across different loading methods and environments
3️⃣ UMD umdDependencyResolution(version)
Test UMD bundle inline dependency resolution without external imports
⭐ esm.sh CDN Tests (v0.0.19) - Recommended Solution
1️⃣ EsmSh loadFromEsmSh(version)
Test loading Nagini from esm.sh CDN with automatic ES6 dependency resolution
2️⃣ EsmSh esmShDependencyResolution(version)
Test esm.sh automatic dependency resolution capabilities - the key advantage
3️⃣ EsmSh esmShPerformance(version)
Test esm.sh performance and caching behavior for optimal loading speeds
⭐ esm.sh Execution Tests (v0.0.19) - Python via esm.sh
1️⃣ EsmShExecution executeSimpleCode(version)
Test actual Python code execution using esm.sh-loaded Nagini in isolated environment
2️⃣ EsmShExecution executeWithLibraries(version)
Test execution with Python libraries support via esm.sh CDN
3️⃣ EsmShExecution esmShVsRawJsDelivr(version)
Comparison test: esm.sh (works) vs raw jsDelivr (fails) - demonstrates the solution

Logs

Display JS logs [Lines from logs: 0]

    

Warning

Wait for the Programmatic tests above to finish before running the interactive tests.
We could use a separate Manager but tests are already long enough ro run.

Interactive tests

Input (with Pyodide)

Test interactive input functionality with input() calls:




    

Matplotlib (with Pyodide)

Test matplotlib figure generation and base64 capture:




    

Turtle (with Brython)

Run Brython turtle graphics in the same page: