Skip to content

Commit e8cbae4

Browse files
test(langchain): add test runner for ChatPromptTemplate save/load functionality
1 parent afc76ea commit e8cbae4

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

test.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Test runner for issue #32637: ChatPromptTemplate save/load functionality
5+
# Supports 'base' and 'new' modes for testing harness.
6+
#
7+
# Usage: ./test.sh [base|new]
8+
# base - No-op mode (original code baseline)
9+
# new - Run tests for ChatPromptTemplate save/load implementation
10+
11+
MODE="${1:-new}"
12+
13+
case "$MODE" in
14+
base)
15+
# Base mode: no-op (tests would fail on original code without save() implementation)
16+
echo "[base mode] Skipping tests on original code (save() not yet implemented)"
17+
exit 0
18+
;;
19+
new)
20+
# New mode: run pytest on issue #32637 tests
21+
echo "[new mode] Running ChatPromptTemplate save/load tests..."
22+
cd "$(dirname "$0")"
23+
24+
# Run pytest on the specific test file with verbose output
25+
python -m pytest \
26+
libs/core/tests/unit_tests/prompts/test_chat.py::test_chat_prompt_template_save_json \
27+
libs/core/tests/unit_tests/prompts/test_chat.py::test_chat_prompt_template_save_yaml \
28+
libs/core/tests/unit_tests/prompts/test_chat.py::test_chat_prompt_template_load_json_roundtrip \
29+
libs/core/tests/unit_tests/prompts/test_chat.py::test_chat_prompt_template_load_yaml_roundtrip \
30+
libs/core/tests/unit_tests/prompts/test_chat.py::test_chat_prompt_template_save_unsupported_format \
31+
libs/core/tests/unit_tests/prompts/test_chat.py::test_chat_prompt_template_save_invalid_path \
32+
libs/core/tests/unit_tests/prompts/test_chat.py::test_chat_prompt_template_save_creates_parent_directories \
33+
-v --tb=short 2>&1
34+
;;
35+
*)
36+
echo "Usage: $0 [base|new]"
37+
echo ""
38+
echo "Modes:"
39+
echo " base - No-op mode (original code baseline)"
40+
echo " new - Run ChatPromptTemplate save/load tests"
41+
exit 2
42+
;;
43+
esac

0 commit comments

Comments
 (0)