Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")