1. Mark Roddy
  2. Larvotto

Commits

Mark Roddy  committed 18abc0a

Updated to reflect new constructor signature of the MarkovChain class.

  • Participants
  • Parent commits 3dd0361
  • Branches logparse-refactor

Comments (0)

Files changed (1)

File larvotto/tests/test_response.py

View file
 import unittest
 import larvotto.response
 
+from larvotto.convsrc import PidginLogParser, PidginLog, PidginLogRecord
 
 class EchoTest(unittest.TestCase):
 	"""Unit test for the L{larvotto.response.Echo} class"""
 	"""Unit test for the L{larvotto.response.MarkovChain} class"""
 	precision=2
 	convos=[
-		(None,'me', "hey, how's it going"),
-		(None,'you',"ah ok I guess"),
-		(None,'me', "did you see the show?"),
-		(None,'you',"no it was sold out"),
-		(None,'me','Yes!')]
+		( "hey, how's it going",'me',None),
+		("ah ok I guess",'you',None),
+		("did you see the show?",'me', None),
+		("no it was sold out",'you',None),
+		('Yes!','me',None)]
 
 	def setUp(self):
-		self.resp=larvotto.response.MarkovChain('me',self.convos,self.precision)
+		records=map(lambda args: PidginLogRecord(*args), self.convos)
+		log=PidginLog(records,None)
+		logs=PidginLogParser([log,])
+		self.resp=larvotto.response.MarkovChain.fromLogs('me',logs,self.precision)
 
 	def testGet(self):
 		resp=self.resp.get('you','hey there')