File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed
Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change 11import pathlib
22
3- import pydantic
4- import yaml
5-
6- from pdl .pdl_ast import Program
3+ from pdl .pdl_parser import PDLParseError , parse_file
74
85EXPECTED_INVALID = [
96 pathlib .Path ("tests" ) / "data" / "line" / "hello.pdl" ,
2017def test_valid_programs () -> None :
2118 actual_invalid : set [str ] = set ()
2219 for yaml_file_name in pathlib .Path ("." ).glob ("**/*.pdl" ):
23- with open (yaml_file_name , "r" , encoding = "utf-8" ) as pdl_file :
24- try :
25- data = yaml .safe_load (pdl_file )
26- _ = Program .model_validate (data )
27- except pydantic .ValidationError :
28- actual_invalid |= {str (yaml_file_name )}
20+ try :
21+ _ = parse_file (yaml_file_name )
22+ except PDLParseError :
23+ actual_invalid |= {str (yaml_file_name )}
2924 expected_invalid = set (str (p ) for p in EXPECTED_INVALID )
3025 unexpected_invalid = sorted (list (actual_invalid - expected_invalid ))
3126 assert len (unexpected_invalid ) == 0 , unexpected_invalid
Original file line number Diff line number Diff line change 3939 pathlib .Path ("examples" ) / "granite" / "single_round_chat.pdl" ,
4040 pathlib .Path ("examples" ) / "joke" / "Joke.pdl" ,
4141 pathlib .Path ("examples" ) / "react" / "multi-agent.pdl" ,
42+ pathlib .Path ("examples" ) / "react" / "wikipedia.pdl" ,
4243 pathlib .Path ("examples" ) / "talk" / "11-sdg.pdl" ,
4344 pathlib .Path ("examples" ) / "talk" / "7-chatbot-roles.pdl" ,
4445 pathlib .Path ("examples" ) / "talk" / "8-tools.pdl" ,
46+ pathlib .Path ("examples" ) / "talk" / "9-react.pdl" ,
4547 pathlib .Path ("examples" ) / "teacher" / "teacher.pdl" ,
4648 pathlib .Path ("examples" ) / "tools" / "calc.pdl" ,
4749 pathlib .Path ("examples" ) / "tutorial" / "include.pdl" ,
You can’t perform that action at this time.
0 commit comments