Skip to content

Commit

Permalink
Get data dir in game_theory/tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oyamad committed Nov 6, 2024
1 parent 61d102b commit 82e4eba
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions quantecon/game_theory/tests/test_howson_lcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,27 @@
from quantecon.game_theory.howson_lcp import polym_lcp_solver
from quantecon.game_theory.polymatrix_game import PolymatrixGame

import os


# Mimicing quantecon.tests.util.get_data_dir
data_dir_name = "gam_files"
this_dir = os.path.dirname(__file__)
data_dir = os.path.join(this_dir, data_dir_name)


def test_polym_lcp_solver_where_solution_is_pure_NE():
filename = "gam_files/big_polym.gam"
nfg = qe_nfg_from_gam_file(filename)
filename = "big_polym.gam"
nfg = qe_nfg_from_gam_file(os.path.join(data_dir, filename))
polym = PolymatrixGame.from_nf(nfg)
ne = polym_lcp_solver(polym)
worked = nfg.is_nash(ne)
assert_(worked)


def test_polym_lcp_solver_where_lcp_solver_must_backtrack():
filename = "gam_files/triggers_back_case.gam"
nfg = qe_nfg_from_gam_file(filename)
filename = "triggers_back_case.gam"
nfg = qe_nfg_from_gam_file(os.path.join(data_dir, filename))
polym = PolymatrixGame.from_nf(nfg)
ne = polym_lcp_solver(polym)
worked = nfg.is_nash(ne)
Expand Down

0 comments on commit 82e4eba

Please sign in to comment.