Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mandel committed Oct 1, 2024
1 parent efd71f5 commit d81a06b
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 28 deletions.
1 change: 0 additions & 1 deletion examples/react/wikipedia.pdl
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,4 @@ text:
except wikipedia.WikipediaException as e:
result = str(e)
until: ${ action.name != "Search" }
as: text
- "\n"
42 changes: 24 additions & 18 deletions pdl-live/src/pdl_ast.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1323,11 +1323,6 @@ export type Repeat =
| ErrorBlock
| EmptyBlock
)[];
/**
* Define how to combine the result of each iteration.
*
*/
export type IterationType = "lastOf" | "array" | "text";
export type Trace1 =
| (
| number
Expand Down Expand Up @@ -1501,11 +1496,6 @@ export type Repeat1 =
| ErrorBlock
| EmptyBlock
)[];
/**
* Define how to combine the result of each iteration.
*
*/
export type IterationType1 = "lastOf" | "array" | "text";
export type Trace2 =
| (
| number
Expand Down Expand Up @@ -1684,11 +1674,6 @@ export type Repeat2 =
*
*/
export type NumIterations = number;
/**
* Define how to combine the result of each iteration.
*
*/
export type IterationType2 = "lastOf" | "array" | "text";
export type Trace3 =
| (
| number
Expand Down Expand Up @@ -3577,7 +3562,7 @@ export interface RepeatBlock {
kind?: Kind11;
repeat: Repeat2;
num_iterations: NumIterations;
as?: IterationType2;
join?: JoinConfig2;
trace?: Trace3;
}
/**
Expand Down Expand Up @@ -3657,7 +3642,7 @@ export interface RepeatUntilBlock {
kind?: Kind10;
repeat: Repeat1;
until: Until;
as?: IterationType1;
join?: JoinConfig1;
trace?: Trace2;
}
/**
Expand Down Expand Up @@ -3737,7 +3722,7 @@ export interface ForBlock {
kind?: Kind9;
for: For;
repeat: Repeat;
as?: IterationType;
join?: JoinConfig;
trace?: Trace1;
}
/**
Expand Down Expand Up @@ -4519,13 +4504,34 @@ export interface Table {
export interface For {
[k: string]: unknown;
}
/**
* Define how to combine the result of each iteration.
*
*/
export interface JoinConfig {
[k: string]: unknown;
}
/**
* Condition of the loop.
*
*/
export interface Until {
[k: string]: unknown;
}
/**
* Define how to combine the result of each iteration.
*
*/
export interface JoinConfig1 {
[k: string]: unknown;
}
/**
* Define how to combine the result of each iteration.
*
*/
export interface JoinConfig2 {
[k: string]: unknown;
}
/**
* Condition.
*
Expand Down
96 changes: 87 additions & 9 deletions pdl-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4773,12 +4773,23 @@
"title": "Repeat"
},
"join": {
"$ref": "#/$defs/JoinConfig",
"anyOf": [
{
"$ref": "#/$defs/JoinText"
},
{
"$ref": "#/$defs/JoinArray"
},
{
"$ref": "#/$defs/JoinLastOf"
}
],
"default": {
"as": "text",
"with": ""
},
"description": "Define how to combine the result of each iteration.\n "
"description": "Define how to combine the result of each iteration.\n ",
"title": "Join"
},
"trace": {
"anyOf": [
Expand Down Expand Up @@ -7260,9 +7271,54 @@
"title": "IncludeBlock",
"type": "object"
},
"JoinConfig": {
"properties": {},
"title": "JoinConfig",
"JoinArray": {
"properties": {
"as": {
"const": "array",
"default": "array",
"enum": [
"array"
],
"title": "As",
"type": "string"
}
},
"title": "JoinArray",
"type": "object"
},
"JoinLastOf": {
"properties": {
"as": {
"const": "lastOf",
"default": "lastOf",
"enum": [
"lastOf"
],
"title": "As",
"type": "string"
}
},
"title": "JoinLastOf",
"type": "object"
},
"JoinText": {
"properties": {
"as": {
"const": "text",
"default": "text",
"enum": [
"text"
],
"title": "As",
"type": "string"
},
"with": {
"default": "",
"title": "With",
"type": "string"
}
},
"title": "JoinText",
"type": "object"
},
"LastOfBlock": {
Expand Down Expand Up @@ -12115,12 +12171,23 @@
"type": "integer"
},
"join": {
"$ref": "#/$defs/JoinConfig",
"anyOf": [
{
"$ref": "#/$defs/JoinText"
},
{
"$ref": "#/$defs/JoinArray"
},
{
"$ref": "#/$defs/JoinLastOf"
}
],
"default": {
"as": "text",
"with": ""
},
"description": "Define how to combine the result of each iteration.\n "
"description": "Define how to combine the result of each iteration.\n ",
"title": "Join"
},
"trace": {
"anyOf": [
Expand Down Expand Up @@ -12871,12 +12938,23 @@
"title": "Until"
},
"join": {
"$ref": "#/$defs/JoinConfig",
"anyOf": [
{
"$ref": "#/$defs/JoinText"
},
{
"$ref": "#/$defs/JoinArray"
},
{
"$ref": "#/$defs/JoinLastOf"
}
],
"default": {
"as": "text",
"with": ""
},
"description": "Define how to combine the result of each iteration.\n "
"description": "Define how to combine the result of each iteration.\n ",
"title": "Join"
},
"trace": {
"anyOf": [
Expand Down
1 change: 1 addition & 0 deletions tests/test_cond.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ def test_repeat_until_text():
}
],
"until": "${ I == 5 }",
"join": {"with": "\n"},
},
],
}
Expand Down

0 comments on commit d81a06b

Please sign in to comment.