Exemplo n.º 1
0
 def test_parse_string_removed_title(self):
     ft = self.file_text.replace(
         '"Selten (IJGT, 75), Figure 2, normal form"', "")
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(str(e.exception),
                             "line 1:11: Game title missing")
Exemplo n.º 2
0
 def test_parse_string_removed_player(self):
     ft = self.file_text.replace('"Player 2"', '')
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(
         str(e.exception),
         "line 1:73: Not enough players for number of strategy entries")
Exemplo n.º 3
0
 def test_parse_string_removed_title(self):
     ft = self.file_text.replace('"Selten (IJGT, 75), Figure 2, normal form"',
                                 "")
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(str(e.exception),
                             "line 1:11: Game title missing")
Exemplo n.º 4
0
 def test_parse_string_extra_payoff(self):
     ft = self.file_text.replace("1, 1", "1, 2, 3")
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(str(e.exception),
                             "line 5:29: Expecting '}' after outcome")
Exemplo n.º 5
0
 def test_parse_string_removed_player(self):
     ft = self.file_text.replace('"Player 2"', '')
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(str(e.exception),
                             "line 5:26: Expecting '}' after outcome")
Exemplo n.º 6
0
 def test_parse_string_node_type(self):
     ft = self.file_text.replace('p "" 1 1', 'x "" 1 1')
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(str(e.exception),
                             "line 4:3: Invalid type of node")
Exemplo n.º 7
0
 def test_parse_string_wrong_precision(self):
     ft = self.file_text.replace("EFG 2 R", "EFG 2 X")
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(str(e.exception),
                             "line 1:9: Accepting only EFG R or D data type")
Exemplo n.º 8
0
 def test_parse_string_wrong_version(self):
     ft = self.file_text.replace("EFG 2", "EFG 1")
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(str(e.exception),
                             "line 1:6: Accepting only EFG version 2")
Exemplo n.º 9
0
 def test_parse_string_wrong_magic(self):
     ft = self.file_text.replace("EFG", "")
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(str(e.exception),
                             "line 1:3: Expecting file type")
Exemplo n.º 10
0
 def test_parse_string_wrong_magic(self):
     ft = self.file_text.replace("EFG", "")
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(str(e.exception),
                             "line 1:3: Expecting file type")
Exemplo n.º 11
0
 def test_parse_string_extra_payoff(self):
     ft = self.file_text.replace("1, 1", "1, 2, 3")
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(str(e.exception),
                             "line 5:29: Expecting '}' after outcome")
Exemplo n.º 12
0
 def test_parse_string_removed_player(self):
     ft = self.file_text.replace('"Player 2"', '')
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(str(e.exception),
                             "line 5:26: Expecting '}' after outcome")
Exemplo n.º 13
0
 def test_parse_string_node_type(self):
     ft = self.file_text.replace('p "" 1 1', 'x "" 1 1')
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(str(e.exception),
                             "line 4:3: Invalid type of node")
Exemplo n.º 14
0
 def test_parse_string_wrong_precision(self):
     ft = self.file_text.replace("EFG 2 R", "EFG 2 X")
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(
         str(e.exception), "line 1:9: Accepting only EFG R or D data type")
Exemplo n.º 15
0
 def test_parse_string_wrong_version(self):
     ft = self.file_text.replace("EFG 2", "EFG 1")
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(str(e.exception),
                             "line 1:6: Accepting only EFG version 2")
Exemplo n.º 16
0
 def test_parse_string_empty(self):
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game("")
     nose.tools.assert_equal(str(e.exception),
                             "line 1:2: Expecting file type")
Exemplo n.º 17
0
 def test_parse_string_removed_player(self):
     ft = self.file_text.replace('"Player 2"', '')
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game(ft)
     nose.tools.assert_equal(str(e.exception),
                             "line 1:73: Not enough players for number of strategy entries")
Exemplo n.º 18
0
 def test_parse_string_empty(self):
     with nose.tools.assert_raises(IOError) as e:
         gambit.parse_game("")
     nose.tools.assert_equal(str(e.exception),
                             "line 1:2: Expecting file type")