88# but WITHOUT ANY WARRANTY; without even the implied warranty of
99# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1010#
11- # $Id: test_htmltemplate.py,v 1.3 2002-01-22 06:35:40 richard Exp $
11+ # $Id: test_htmltemplate.py,v 1.4 2002-01-22 22:46:22 richard Exp $
1212
1313import unittest , cgi
1414
@@ -183,7 +183,7 @@ def testMenu_multilink(self):
183183# def do_link(self, property=None, is_download=0):
184184 def testLink_novalue (self ):
185185 self .assertEqual (self .tf .do_link ('novalue' ),
186- _ ('[no %(propname)s]' )% {'propname' :'novalue' .capitalize ()})
186+ _ ('[no %(propname)s]' )% {'propname' :'novalue' .capitalize ()})
187187
188188 def testLink_string (self ):
189189 self .assertEqual (self .tf .do_link ('string' ),
@@ -209,12 +209,41 @@ def testLink_multilink(self):
209209 self .assertEqual (self .tf .do_link ('multilink' ),
210210 '<a href="other1">the key</a>, <a href="other2">the key</a>' )
211211
212+ # def do_count(self, property, **args):
213+ def testCount_nonlinks (self ):
214+ s = _ ('[Count: not a Multilink]' )
215+ self .assertEqual (self .tf .do_count ('string' ), s )
216+ self .assertEqual (self .tf .do_count ('date' ), s )
217+ self .assertEqual (self .tf .do_count ('interval' ), s )
218+ self .assertEqual (self .tf .do_count ('password' ), s )
219+ self .assertEqual (self .tf .do_count ('link' ), s )
220+
221+ def testCount_multilink (self ):
222+ self .assertEqual (self .tf .do_count ('multilink' ), '2' )
223+
224+ # def do_reldate(self, property, pretty=0):
225+ def testReldate_nondate (self ):
226+ s = _ ('[Reldate: not a Date]' )
227+ self .assertEqual (self .tf .do_reldate ('string' ), s )
228+ self .assertEqual (self .tf .do_reldate ('interval' ), s )
229+ self .assertEqual (self .tf .do_reldate ('password' ), s )
230+ self .assertEqual (self .tf .do_reldate ('link' ), s )
231+ self .assertEqual (self .tf .do_reldate ('multilink' ), s )
232+
233+ def testReldate_date (self ):
234+ self .assertEqual (self .tf .do_reldate ('date' ), '- 2y 1m' )
235+ self .assertEqual (self .tf .do_reldate ('date' , pretty = 1 ),
236+ ' 1 January 2000' )
237+
212238def suite ():
213239 return unittest .makeSuite (NodeCase , 'test' )
214240
215241
216242#
217243# $Log: not supported by cvs2svn $
244+ # Revision 1.3 2002/01/22 06:35:40 richard
245+ # more htmltemplate tests and cleanup
246+ #
218247# Revision 1.2 2002/01/22 00:12:07 richard
219248# Wrote more unit tests for htmltemplate, and while I was at it, I polished
220249# off the implementation of some of the functions so they behave sanely.
0 commit comments