Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.

Commit

Permalink
made checks in test a little better
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-gardner committed Dec 3, 2020
1 parent 976b93e commit 258900c
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions tests/domain_languages/nlvr_language_v2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,20 +335,14 @@ def test_complex_action_sequence_execution(self):

# Logical-form
# '(box_count_equals 2 ((* ((* (box_filter object_exists) box_filter) object_exists) box_filter) all_boxes (* object_exists yellow)))'

failed = False
try:
language.execute_action_sequence(action_sequence=action_sequence)
except:
failed = True

assert failed is False
result = language.execute_action_sequence(action_sequence=action_sequence)
assert result is False

action_sequence = [
"@start@ -> bool",
"bool -> [<int,Set[Box]:bool>, int, Set[Box]]",
"<int,Set[Box]:bool> -> box_count_equals",
"int -> 2",
"int -> 1",
"Set[Box] -> [<Set[Box],<Set[Object]:bool>:Set[Box]>, Set[Box], <Set[Object]:bool>]",
"<Set[Box],<Set[Object]:bool>:Set[Box]> -> [*, <Set[Box]:Set[Box]>, <Set[Box],<Set[Object]:bool>:Set[Box]>]",
"<Set[Box]:Set[Box]> -> [<Set[Box],<Set[Object]:bool>:Set[Box]>, <Set[Object]:bool>]",
Expand All @@ -365,15 +359,10 @@ def test_complex_action_sequence_execution(self):
"<Set[Object]:Set[Object]> -> black",
]
# logical-form
# '(box_count_equals 2 ((* ((* (box_filter object_exists) box_filter) object_exists) box_filter) all_boxes (* object_exists black)))'

failed = False
try:
language.execute_action_sequence(action_sequence=action_sequence)
except:
failed = True
# '(box_count_equals 1 ((* ((* (box_filter object_exists) box_filter) object_exists) box_filter) all_boxes (* object_exists black)))'

assert failed is False
result = language.execute_action_sequence(action_sequence=action_sequence)
assert result is True

def test_get_agenda_for_sentence(self):
language = self.languages[0]
Expand Down

0 comments on commit 258900c

Please sign in to comment.