Skip to content

Commit

Permalink
TEST: Add tests for vertex_enumeration.py
Browse files Browse the repository at this point in the history
  • Loading branch information
QBatista committed Aug 27, 2017
1 parent 1389f5e commit 5453ed3
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion quantecon/game_theory/tests/test_vertex_enumeration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""
import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
from nose.tools import eq_
from nose.tools import eq_, raises
from quantecon.game_theory import NormalFormGame, vertex_enumeration
from quantecon.game_theory.vertex_enumeration import _BestResponsePolytope

Expand Down Expand Up @@ -46,6 +46,14 @@ def test_vertex_enumeration(self):
assert_allclose(action_computed, action)


@raises(TypeError)
def test_vertex_enumeration_invalid_g():
bimatrix = [[(3, 3), (3, 2)],
[(2, 2), (5, 6)],
[(0, 3), (6, 1)]]
vertex_enumeration(bimatrix)


class TestBestResponsePolytope:
def setUp(self):
# From von Stengel 2007 in Algorithmic Game Theory
Expand Down Expand Up @@ -98,6 +106,15 @@ def test_best_response_polytope(self):
assert_allclose(vertices_computed, self.vertices_P, atol=1e-15)


@raises(TypeError)
def test_best_response_polytope_invalid_player_instance():
bimatrix = [[(3, 3), (3, 2)],
[(2, 2), (5, 6)],
[(0, 3), (6, 1)]]
g = NormalFormGame(bimatrix)
_BestResponsePolytope(g)


if __name__ == '__main__':
import sys
import nose
Expand Down

0 comments on commit 5453ed3

Please sign in to comment.