77import io
88import logging
99import os
10+ import pathlib
1011import pickle
1112import warnings
1213from multiprocessing import Queue , cpu_count
@@ -90,7 +91,8 @@ def setUpClass(cls):
9091 [200 , 200 , 1 , 200 , 200 ],
9192 ]
9293
93- cls .filename = axl_filename ("test_outputs" , "test_tournament.csv" )
94+ path = pathlib .Path ("test_outputs/test_tournament.csv" )
95+ cls .filename = axl_filename (path )
9496
9597 def setUp (self ):
9698 self .test_tournament = axl .Tournament (
@@ -110,9 +112,7 @@ def test_init(self):
110112 noise = 0.2 ,
111113 )
112114 self .assertEqual (len (tournament .players ), len (test_strategies ))
113- self .assertIsInstance (
114- tournament .players [0 ].match_attributes ["game" ], axl .Game
115- )
115+ self .assertIsInstance (tournament .players [0 ].match_attributes ["game" ], axl .Game )
116116 self .assertEqual (tournament .game .score ((C , C )), (3 , 3 ))
117117 self .assertEqual (tournament .turns , self .test_turns )
118118 self .assertEqual (tournament .repetitions , 10 )
@@ -415,9 +415,7 @@ def test_progress_bar_play_parallel(self):
415415 # these two examples were identified by hypothesis.
416416 @example (
417417 tournament = axl .Tournament (
418- players = [axl .BackStabber (), axl .MindReader ()],
419- turns = 2 ,
420- repetitions = 1 ,
418+ players = [axl .BackStabber (), axl .MindReader ()], turns = 2 , repetitions = 1 ,
421419 )
422420 )
423421 @example (
@@ -735,9 +733,8 @@ def test_write_to_csv_with_results(self):
735733 )
736734 tournament .play (filename = self .filename , progress_bar = False )
737735 df = pd .read_csv (self .filename )
738- expected_df = pd .read_csv (
739- axl_filename ("test_outputs" , "expected_test_tournament.csv" )
740- )
736+ path = pathlib .Path ("test_outputs/expected_test_tournament.csv" )
737+ expected_df = pd .read_csv (axl_filename (path ))
741738 self .assertTrue (df .equals (expected_df ))
742739
743740 def test_write_to_csv_without_results (self ):
@@ -750,9 +747,8 @@ def test_write_to_csv_without_results(self):
750747 )
751748 tournament .play (filename = self .filename , progress_bar = False , build_results = False )
752749 df = pd .read_csv (self .filename )
753- expected_df = pd .read_csv (
754- axl_filename ("test_outputs" , "expected_test_tournament_no_results.csv" )
755- )
750+ path = pathlib .Path ("test_outputs/expected_test_tournament_no_results.csv" )
751+ expected_df = pd .read_csv (axl_filename (path ))
756752 self .assertTrue (df .equals (expected_df ))
757753
758754
@@ -808,16 +804,12 @@ def test_init(self):
808804 # these two examples were identified by hypothesis.
809805 @example (
810806 tournament = axl .Tournament (
811- players = [axl .BackStabber (), axl .MindReader ()],
812- prob_end = 0.2 ,
813- repetitions = 1 ,
807+ players = [axl .BackStabber (), axl .MindReader ()], prob_end = 0.2 , repetitions = 1 ,
814808 )
815809 )
816810 @example (
817811 tournament = axl .Tournament (
818- players = [axl .ThueMorse (), axl .MindReader ()],
819- prob_end = 0.2 ,
820- repetitions = 1 ,
812+ players = [axl .ThueMorse (), axl .MindReader ()], prob_end = 0.2 , repetitions = 1 ,
821813 )
822814 )
823815 def test_property_serial_play (self , tournament ):
0 commit comments