Skip to content

Commit

Permalink
linemap tests cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Mandana Vaziri <[email protected]>
  • Loading branch information
vazirim committed Aug 31, 2024
1 parent c745012 commit e20cc8e
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 173 deletions.
6 changes: 5 additions & 1 deletion tests/data/line/hello14.pdl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ document:
spec: int
return:
- "\nTranslate the sentence '{{ sentence }}' to {{ language }}\n"
- model: ibm/granite-34b-code-instruct
- model: ibm/granite-20b-multilingual
params:
stop_sequences:
- '!'
include_stop_sequence: true
- call: translate
spec: str
args:
Expand Down
2 changes: 1 addition & 1 deletion tests/data/line/hello16.pdl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ document:
as: document
- 'Question: Write a JSON object with 2 fields "bob" and "carol" set to "20" and "30" respectively.'
parser: yaml
parameters:
params:
decoding_method: greedy
stop_sequences:
- '}'
Expand Down
12 changes: 0 additions & 12 deletions tests/data/line/hello2.pdl

This file was deleted.

7 changes: 6 additions & 1 deletion tests/data/line/hello25.pdl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ document:
language: str
return:
- "\nTranslate the sentence '{{ sentence1 }}' to {{ language }}\n"
- model: ibm/granite-34b-code-instruct
- model: ibm/granite-20b-multilingual
params:
stop_sequences:
- "!"
- "\n"
include_stop_sequence: true
- call: translate
spec: str
args:
Expand Down
3 changes: 0 additions & 3 deletions tests/data/line/hello27.pdl

This file was deleted.

19 changes: 0 additions & 19 deletions tests/data/line/hello5.pdl

This file was deleted.

20 changes: 0 additions & 20 deletions tests/data/line/hello6.pdl

This file was deleted.

168 changes: 52 additions & 116 deletions tests/test_line_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,6 @@ def test_line1(capsys):
do_test(line1, capsys)


line2 = {
"file": "tests/data/line/hello2.pdl",
"errors": [
"",
"tests/data/line/hello2.pdl:9 - Field not allowed: decoding_methods",
"tests/data/line/hello2.pdl:10 - Field not allowed: stop_sequencess",
],
}

# XXX The type checking of BAM parameters is now weaker
# def test_line2(capsys):
# do_test(line2, capsys)


line3 = {
"file": "tests/data/line/hello3.pdl",
"errors": [
Expand Down Expand Up @@ -81,34 +67,6 @@ def test_line4(capsys):
do_test(line4, capsys)


line5 = {
"file": "tests/data/line/hello5.pdl",
"errors": [
"",
"tests/data/line/hello5.pdl:19 - Field not allowed: include_stop_sequences",
],
}

# XXX The type checking of BAM parameters is now weaker
# def test_line5(capsys):
# do_test(line5, capsys)


line6 = {
"file": "tests/data/line/hello6.pdl",
"errors": [
"",
"tests/data/line/hello6.pdl:7 - Field not allowed: foo",
"tests/data/line/hello6.pdl:6 - Field not allowed: decoding_methoda",
"tests/data/line/hello6.pdl:20 - Field not allowed: include_stop_sequences",
],
}

# XXX The type checking of BAM parameters is now weaker
# def test_line6(capsys):
# do_test(line6, capsys)


line7 = {
"file": "tests/data/line/hello7.pdl",
"errors": [
Expand Down Expand Up @@ -209,25 +167,21 @@ def test_line13(capsys):
do_test(line13, capsys)


# line14 = {
# "file": "tests/data/line/hello14.pdl",
# "errors": [
# "",
# "Hello, world!",
# "Translate the sentence 'Hello, World!' to French",
# "Bonjour le monde !",
# "Translate the sentence 'Hello, World!' to German",
# "Hallo Welt!",
# "tests/data/line/hello14.pdl:19 - Type errors in result of function call to translate", # pylint: disable=line-too-long
# "tests/data/line/hello14.pdl:15 - Bonjour le monde !",
# "Translate the sentence 'Hello, world!' to German",
# "Hallo Welt! should be of type <class 'int'>",
# ],
# }
line14 = {
"file": "tests/data/line/hello14.pdl",
"errors": [
"",
"Hello, World!",
"Translate the sentence 'Hello, World!' to French",
"Bonjour le monde!",
"tests/data/line/hello14.pdl:22 - Type errors in result of function call to translate",
"tests/data/line/hello14.pdl:15 - Bonjour le monde! should be of type <class 'int'>",
],
}


# def test_line14(capsys):
# do_test(line14, capsys)
def test_line14(capsys):
do_test(line14, capsys)


line15 = {
Expand All @@ -246,19 +200,19 @@ def test_line15(capsys):
do_test(line15, capsys)


# line16 = {
# "file": "tests/data/line/hello16.pdl",
# "errors": [
# "",
# "{'bob': 20, 'carol': 30}",
# "tests/data/line/hello16.pdl:8 - Type errors during spec checking",
# "tests/data/line/hello16.pdl:8 - 30 should be of type <class 'str'>",
# ],
# }
line16 = {
"file": "tests/data/line/hello16.pdl",
"errors": [
"",
'{"bob": 20, "carol": 30}',
"tests/data/line/hello16.pdl:8 - Type errors during spec checking",
"tests/data/line/hello16.pdl:8 - 30 should be of type <class 'str'>",
],
}


# def test_line16(capsys):
# do_test(line16, capsys)
def test_line16(capsys):
do_test(line16, capsys)


line17 = {
Expand Down Expand Up @@ -353,40 +307,40 @@ def test_line23(capsys):
do_test(line23, capsys)


# line24 = {
# "file": "tests/data/line/hello24.pdl",
# "errors": [
# "",
# "Hello, world!",
# "tests/data/line/hello24.pdl:21 - 'GEN1' is undefined",
# "tests/data/line/hello24.pdl:22 - 'GEN2' is undefined",
# "tests/data/line/hello24.pdl:20 - Type errors during function call to translate",
# "tests/data/line/hello24.pdl:21 - None should be of type <class 'str'>",
# "tests/data/line/hello24.pdl:22 - None should be of type <class 'str'>",
# "tests/data/line/hello24.pdl:18 - Type errors during spec checking",
# "tests/data/line/hello24.pdl:18 - None should be of type <class 'str'>",
# ],
# }
line24 = {
"file": "tests/data/line/hello24.pdl",
"errors": [
"",
"Hello, World!",
"tests/data/line/hello24.pdl:21 - 'GEN1' is undefined",
"tests/data/line/hello24.pdl:22 - 'GEN2' is undefined",
"tests/data/line/hello24.pdl:20 - Type errors during function call to translate",
"tests/data/line/hello24.pdl:21 - None should be of type <class 'str'>",
"tests/data/line/hello24.pdl:22 - None should be of type <class 'str'>",
"tests/data/line/hello24.pdl:18 - Type errors during spec checking",
"tests/data/line/hello24.pdl:18 - None should be of type <class 'str'>",
],
}


# def test_line24(capsys):
# do_test(line24, capsys)
def test_line24(capsys):
do_test(line24, capsys)


# line25 = {
# "file": "tests/data/line/hello25.pdl",
# "errors": [
# "",
# "Hello, World!",
# "tests/data/line/hello25.pdl:15 - 'sentence1' is undefined",
# "Translate the sentence '{{ sentence1 }}' to {{ language }}",
# "Hello, world!",
# ],
# }
line25 = {
"file": "tests/data/line/hello25.pdl",
"errors": [
"",
"Hello, World!",
"tests/data/line/hello25.pdl:15 - 'sentence1' is undefined",
"Translate the sentence '{{ sentence1 }}' to {{ language }}",
"{{ translate(sentence1) }}",
],
}


# def test_line25(capsys):
# do_test(line25, capsys)
def test_line25(capsys):
do_test(line25, capsys)


line26 = {
Expand All @@ -410,24 +364,6 @@ def test_line26(capsys):
do_test(line26, capsys)


line27 = {
"file": "tests/data/line/hello27.pdl",
"errors": [
"",
"",
"tests/data/line/hello27.pdl:3 - Attempting to include invalid yaml: tests/data/line/hello2.pdl", # pylint: disable=line-too-long
"tests/data/line/hello2.pdl:9 - Field not allowed: decoding_methods",
"tests/data/line/hello2.pdl:10 - Field not allowed: stop_sequencess",
"",
"",
],
}

# XXX The type checking of BAM parameters is now weaker
# def test_line27(capsys):
# do_test(line27, capsys)


line28 = {
"file": "tests/data/line/hello28.pdl",
"errors": [
Expand Down

0 comments on commit e20cc8e

Please sign in to comment.