Changeset 69 for geniuswebcore/test
- Timestamp:
- 10/11/21 16:01:02 (3 years ago)
- Location:
- geniuswebcore/test
- Files:
-
- 19 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
geniuswebcore/test/geniusweb/progress/ProgressTimeTest.py
r67 r69 41 41 42 42 def testTerminationTime(self): 43 self.assertEqual(datetime.fromtimestamp( 100000900+1999), self.progress.getTerminationTime())43 self.assertEqual(datetime.fromtimestamp((100000900+1999)/1000), self.progress.getTerminationTime()) 44 44 45 45 def testGet(self): -
geniuswebcore/test/geniusweb/simplerunner/SessionRunnerE2ETest.py
r67 r69 27 27 params = ["test/resources/settings.json", 28 28 # "test/resources/settings2.json" , PARTIALORDERING NOT YET 29 "test/resources/settingsbadprofile.json" 29 "test/resources/settingsbadprofile.json", 30 30 # "test/resources/shaoptoursettings.json", ALLPERMUTATIONSETTINGS NOT YET 31 # "test/resources/mopac.json" , MOPAC NOT YET 31 "test/resources/mopac.json" 32 32 # "test/resources/tournament.json" ALLPERMUTATIONSETTINGS NOT YET 33 33 ] -
geniuswebcore/test/resources/mopac.json
r67 r69 4 4 {"TeamInfo":{"parties":[ 5 5 { 6 "party": {"partyref":" classpath:geniusweb.exampleparties.randomparty.RandomParty", "parameters":{"power":1}},7 "profile": "file: src/test/resources/jobs/jobs1.json"6 "party": {"partyref":"pythonpath:test.testparty.TestParty.TestParty", "parameters":{"power":1}}, 7 "profile": "file:test/resources/jobs/jobs1.json" 8 8 } ]}}, 9 9 10 10 {"TeamInfo":{"parties":[ 11 11 { 12 "party": {"partyref":" classpath:geniusweb.exampleparties.randomparty.RandomParty", "parameters":{"power":1}},13 "profile": "file: src/test/resources/jobs/jobs2.json"12 "party": {"partyref":"pythonpath:test.testparty.TestParty.TestParty", "parameters":{"power":1}}, 13 "profile": "file:test/resources/jobs/jobs2.json" 14 14 } ]}} ], 15 15 "deadline": { -
geniuswebcore/test/testparty/TestParty.py
r67 r69 2 2 import logging 3 3 import sys 4 from typing import Dict, Any 4 from typing import Dict, Any, Set 5 5 from typing import cast 6 6 … … 9 9 from geniusweb.actions.Offer import Offer 10 10 from geniusweb.actions.PartyId import PartyId 11 from geniusweb.actions.Vote import Vote 12 from geniusweb.actions.Votes import Votes 11 13 from geniusweb.inform.ActionDone import ActionDone 12 14 from geniusweb.inform.Finished import Finished 13 15 from geniusweb.inform.Inform import Inform 16 from geniusweb.inform.OptIn import OptIn 14 17 from geniusweb.inform.Settings import Settings 18 from geniusweb.inform.Voting import Voting 15 19 from geniusweb.inform.YourTurn import YourTurn 16 20 from geniusweb.issuevalue.Bid import Bid … … 35 39 #self.getReporter().log(logging.INFO,"received info:"+str(info)) 36 40 if isinstance(info,Settings) : 37 se ttings:Settings=cast(Settings,info)38 self._me = se ttings.getID()39 self._protocol = se ttings.getProtocol()41 self._settings:Settings=cast(Settings,info) 42 self._me = self._settings.getID() 43 self._protocol = self._settings.getProtocol() 40 44 elif isinstance(info, ActionDone): 41 45 action:Action=cast( ActionDone,info).getAction() … … 54 58 val(self.getConnection()).send(offer) 55 59 self.getReporter().log(logging.INFO,"sent empty offer:") 60 elif isinstance(info, Voting): 61 # MOPAC protocol 62 self._lastvotes = self._vote(cast(Voting, info)); 63 val(self.getConnection()).send(self._lastvotes) 64 elif isinstance(info, OptIn): 65 val(self.getConnection()).send(self._lastvotes) 66 56 67 elif isinstance(info, Finished): 57 68 self.terminate() … … 76 87 self._profile = None 77 88 89 def _vote(self, voting:Voting) ->Votes : 90 ''' 91 @param voting the {@link Voting} object containing the options 92 93 @return our next Votes. Stupid: vote for all received offers. 94 ''' 95 votes:Set[Vote] = set([Vote(self._me, offer.getBid(), 2, 5)\ 96 for offer in voting.getOffers() ]) 97 return Votes(self._me, votes)
Note:
See TracChangeset
for help on using the changeset viewer.