prompty 2.0.0-beta.1

Prompty is an asset class and format for LLM prompts
Documentation
// Code generated by Prompty emitter; DO NOT EDIT.

#![allow(
    unused_imports,
    dead_code,
    non_camel_case_types,
    unused_variables,
    clippy::all
)]

use prompty::model::ParserConfig;
use prompty::model::context::{LoadContext, SaveContext};

#[test]
fn test_parser_config_load_json() {
    let json = r####"
{
  "kind": "prompty",
  "options": {
    "key": "value"
  }
}
"####;
    let ctx = LoadContext::default();
    let result = ParserConfig::from_json(json, &ctx);
    assert!(
        result.is_ok(),
        "Failed to load from JSON: {:?}",
        result.err()
    );
}

#[test]
fn test_parser_config_load_yaml() {
    let yaml = r####"
kind: prompty
options:
  key: value

"####;
    let ctx = LoadContext::default();
    let result = ParserConfig::from_yaml(yaml, &ctx);
    assert!(
        result.is_ok(),
        "Failed to load from YAML: {:?}",
        result.err()
    );
}

#[test]
fn test_parser_config_roundtrip() {
    let json = r####"
{
  "kind": "prompty",
  "options": {
    "key": "value"
  }
}
"####;
    let load_ctx = LoadContext::default();
    let result = ParserConfig::from_json(json, &load_ctx);
    assert!(result.is_ok(), "Failed to load: {:?}", result.err());
}

#[test]
fn test_parser_config_from_parser() {
    let value = serde_json::json!("example");
    let ctx = LoadContext::default();
    let instance = ParserConfig::load_from_value(&value, &ctx);
    let _ = instance; // abstract type, load succeeded
}