Beispiel #1
0
 def test_build_template_substitutions (self):
     task = Task (name='My Name', flagged=True, date_completed=datetime.strptime('2015-02-03', '%Y-%m-%d'))
     values = build_template_substitutions (task, ATTRIB_CONVERSIONS, ATTRIB_DEFAULTS, ATTRIB_TEMPLATES)
     self.assertEquals(7, len (values))
     self.assertEquals ('My Name', values['name'])
     self.assertEquals (' @done(2015-02-03)', values['date_completed'])
     self.assertEquals (' @flagged', values['flagged'])
     self.assertEquals ('', values['context'])
     self.assertEquals ('', values['date_to_start'])
     self.assertEquals ('', values['date_due'])
     self.assertEquals ('', values['project'])
     
     task = Task (name='My Name', flagged=False, date_completed=datetime.strptime('2015-02-03', '%Y-%m-%d'))
     values = build_template_substitutions (task, ATTRIB_CONVERSIONS, ATTRIB_DEFAULTS, ATTRIB_TEMPLATES)
     self.assertEquals(7, len (values))
     self.assertEquals ('My Name', values['name'])
     self.assertEquals (' @done(2015-02-03)', values['date_completed'])
     self.assertEquals ('', values['context'])
     self.assertEquals ('', values['date_to_start'])
     self.assertEquals ('', values['date_due'])
     self.assertEquals ('', values['project'])
     self.assertEquals ('', values['flagged'])
Beispiel #2
0
 def test_format_item (self):
     task = Task (name='My Name', flagged=True, date_completed=datetime.strptime('2015-02-03', '%Y-%m-%d'))
     template = FmtTemplate(DEFAULT_TEMPLATE)
     attribs = build_template_substitutions (task, ATTRIB_CONVERSIONS, ATTRIB_DEFAULTS, ATTRIB_TEMPLATES)
     line = format_item (template, 'TaskStart', attribs)
     self.assertEquals ('T My Name @flagged @done(2015-02-03)', line)