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 1
1
import pathlib
2
2
3
- import pydantic
4
- import yaml
5
-
6
- from pdl .pdl_ast import Program
3
+ from pdl .pdl_parser import PDLParseError , parse_file
7
4
8
5
EXPECTED_INVALID = [
9
6
pathlib .Path ("tests" ) / "data" / "line" / "hello.pdl" ,
20
17
def test_valid_programs () -> None :
21
18
actual_invalid : set [str ] = set ()
22
19
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 )}
29
24
expected_invalid = set (str (p ) for p in EXPECTED_INVALID )
30
25
unexpected_invalid = sorted (list (actual_invalid - expected_invalid ))
31
26
assert len (unexpected_invalid ) == 0 , unexpected_invalid
Original file line number Diff line number Diff line change 39
39
pathlib .Path ("examples" ) / "granite" / "single_round_chat.pdl" ,
40
40
pathlib .Path ("examples" ) / "joke" / "Joke.pdl" ,
41
41
pathlib .Path ("examples" ) / "react" / "multi-agent.pdl" ,
42
+ pathlib .Path ("examples" ) / "react" / "wikipedia.pdl" ,
42
43
pathlib .Path ("examples" ) / "talk" / "11-sdg.pdl" ,
43
44
pathlib .Path ("examples" ) / "talk" / "7-chatbot-roles.pdl" ,
44
45
pathlib .Path ("examples" ) / "talk" / "8-tools.pdl" ,
46
+ pathlib .Path ("examples" ) / "talk" / "9-react.pdl" ,
45
47
pathlib .Path ("examples" ) / "teacher" / "teacher.pdl" ,
46
48
pathlib .Path ("examples" ) / "tools" / "calc.pdl" ,
47
49
pathlib .Path ("examples" ) / "tutorial" / "include.pdl" ,
You can’t perform that action at this time.
0 commit comments