Skip to content

Commit 068f678

Browse files
committed
Version 1.7.0
1 parent 14ca39d commit 068f678

7 files changed

Lines changed: 7 additions & 26 deletions

File tree

tests/test_textworld.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# Licensed under the MIT license.
33

44

5-
import glob
65
import shutil
76
import tempfile
87
import unittest
@@ -34,14 +33,6 @@ def setUpClass(cls):
3433
def tearDownClass(cls):
3534
shutil.rmtree(cls.tmpdir)
3635

37-
def setUp(self):
38-
self.before_tw = glob.glob(pjoin(tempfile.gettempdir(), "tw_*"))
39-
40-
def tearDown(self):
41-
# Check for file leaks.
42-
after_tw = glob.glob(pjoin(tempfile.gettempdir(), "tw_*"))
43-
assert set(after_tw) == set(self.before_tw)
44-
4536
def test_100_sequential_runs(self):
4637
for gamefile in [self.game_file, self.game_file_z8]:
4738
for _ in range(100):

textworld/challenges/tests/test_coin_collector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_making_coin_collector():
1515
101: {"quest_length": 1, "nb_rooms": 2},
1616
200: {"quest_length": 100, "nb_rooms": 200},
1717
201: {"quest_length": 1, "nb_rooms": 3},
18-
300: {"quest_length": 100, "nb_rooms": 300},
18+
# 300: {"quest_length": 100, "nb_rooms": 300}, # Too large for .z8 game file.
1919
}
2020
for level in [1, 100, 101, 200, 201, 300]:
2121
options = textworld.GameOptions()

textworld/challenges/tests/test_cooking.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def test_making_cooking_games():
2323
"recipe": nb_ingredients,
2424
"take": 3,
2525
"open": True,
26-
"open": True,
2726
"cook": True,
2827
"cut": False,
2928
"drop": False,

textworld/challenges/tw_cooking/cooking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ def _place_one_distractor(candidates, ingredient):
10131013
_place_one_distractor(same_suffix_list, ingredient)
10141014

10151015
# Add distractors foods. The amount is drawn from N(nb_ingredients, 3).
1016-
nb_distractors = abs(int(rng_objects.randn(1) * 3 + nb_ingredients))
1016+
nb_distractors = abs(int(rng_objects.randn(1).item() * 3 + nb_ingredients))
10171017
distractors = place_random_foods(M, nb_distractors, rng_objects, allowed_foods)
10181018

10191019
# If recipe_seed is positive, a new recipe is sampled.

textworld/envs/wrappers/tests/test_tw_inform7.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def setUpClass(cls):
3131
cls.tmpdir = tempfile.mkdtemp()
3232
cls.options = textworld.GameOptions()
3333
cls.options.path = pjoin(cls.tmpdir, "tw-game.z8")
34-
cls.gamefile_z8 = textworld.generator.compile_game(cls.game, cls.options)
34+
cls.game, cls.gamefile_z8 = testing.build_and_compile_game(cls.options)
3535
cls.request_infos = EnvInfos(
3636
inventory=True,
3737
description=True,
@@ -185,7 +185,7 @@ def setUpClass(cls):
185185
cls.tmpdir = tempfile.mkdtemp()
186186
cls.options = textworld.GameOptions()
187187
cls.options.path = pjoin(cls.tmpdir, "tw-game.z8")
188-
cls.gamefile_z8 = textworld.generator.compile_game(cls.game, cls.options)
188+
cls.game, cls.gamefile_z8 = testing.build_and_compile_game(cls.options)
189189
cls.request_infos = EnvInfos(
190190
inventory=True,
191191
description=True,
@@ -270,7 +270,7 @@ def setUpClass(cls):
270270
cls.tmpdir = tempfile.mkdtemp()
271271
cls.options = textworld.GameOptions()
272272
cls.options.path = pjoin(cls.tmpdir, "tw-game.z8")
273-
cls.gamefile_z8 = textworld.generator.compile_game(cls.game, cls.options)
273+
cls.game, cls.gamefile_z8 = testing.build_and_compile_game(cls.options)
274274
cls.request_infos = EnvInfos(
275275
max_score=True,
276276
objective=True,
@@ -356,7 +356,7 @@ def setUpClass(cls):
356356
cls.tmpdir = tempfile.mkdtemp()
357357
cls.options = textworld.GameOptions()
358358
cls.options.path = pjoin(cls.tmpdir, "tw-game.z8")
359-
cls.gamefile_z8 = textworld.generator.compile_game(cls.game, cls.options)
359+
cls.game, cls.gamefile_z8 = testing.build_and_compile_game(cls.options)
360360
cls.request_infos = EnvInfos(
361361
facts=True,
362362
policy_commands=True,

textworld/gym/tests/test_textworld_gym.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import glob
32
import shutil
43
import tempfile
54
import unittest
@@ -34,14 +33,6 @@ def setUpClass(cls):
3433
def tearDownClass(cls):
3534
shutil.rmtree(cls.tmpdir)
3635

37-
def setUp(self):
38-
self.before_tw = glob.glob(pjoin(tempfile.gettempdir(), "tw_*"))
39-
40-
def tearDown(self):
41-
# Check for file leaks.
42-
after_tw = glob.glob(pjoin(tempfile.gettempdir(), "tw_*"))
43-
assert set(after_tw) == set(self.before_tw)
44-
4536
def test_register_game(self):
4637
env_options = EnvInfos(inventory=True, description=True,
4738
admissible_commands=True,

textworld/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.6.2'
1+
__version__ = '1.7.0rc1'

0 commit comments

Comments
 (0)