Skip to content

Commit

Permalink
Clean tests
Browse files Browse the repository at this point in the history
Former-commit-id: 7b9b466
  • Loading branch information
daochenzha committed May 15, 2021
1 parent 2923ca0 commit ea2e041
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ sonar-project.properties
docs/rst
docs/sphinx
experiments/
newtest/
dist/
cfr_model/
rlcard/games/doudizhu/jsondata/
rlcard/agents/gin_rummy_human_agent/gui_cards/cards_png
6 changes: 3 additions & 3 deletions tests/agents/test_cfr.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TestNFSP(unittest.TestCase):
def test_train(self):

env = rlcard.make('leduc-holdem', config={'allow_step_back':True})
agent = CFRAgent(env)
agent = CFRAgent(env, model_path='experiments/cfr_model')

for _ in range(100):
agent.train()
Expand All @@ -21,14 +21,14 @@ def test_train(self):

def test_save_and_load(self):
env = rlcard.make('leduc-holdem', config={'allow_step_back':True})
agent = CFRAgent(env)
agent = CFRAgent(env, model_path='experiments/cfr_model')

for _ in range(100):
agent.train()

agent.save()

new_agent = CFRAgent(env)
new_agent = CFRAgent(env, model_path='experiments/cfr_model')
new_agent.load()
self.assertEqual(len(agent.policy), len(new_agent.policy))
self.assertEqual(len(agent.average_policy), len(new_agent.average_policy))
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class TestLogger(unittest.TestCase):

def test_log(self):
log_dir = "./newtest/test_log.txt"
log_dir = "experiments/newtest/test_log.txt"
if os.path.exists(log_dir):
shutil.rmtree(log_dir)
with Logger(log_dir) as logger:
Expand Down

0 comments on commit ea2e041

Please sign in to comment.