Example #1
0
 def test_glue(self):
     """
     Test the :fn:`core.utils.glue`
     """
     glue_result_first = glue(TESTED_COMPONENTS)
     
     # Test 'join'
     self.assertEqual(
         glue_result_first, 
         ' ' . join(TESTED_COMPONENTS))
     
     # Test 'strip'
     self.assertNotEqual(
         glue_result_first,
         ' ' . join(map(lambda x: ' %s ' % str(x), TESTED_COMPONENTS)))
         
     # Test invalid parameters:
     #   * first:
     with self.assertRaises(AssertionError):
         glue(TESTED_NUM)
         
     #   * second:
     with self.assertRaises(AssertionError):
         glue(TESTED_COMPONENTS, separator=TESTED_NUM)
Example #2
0
 def __unicode__(self):
     return glue([self.first_name, self.last_name, self.middle_name])
Example #3
0
 def __unicode__(self):
     return glue([self.model.name, self.car_no], separator=', ')
Example #4
0
 def __unicode__(self):
     return glue([str(self.person), 
                 glue([_(u'License No.'), self.license_no])], 
                 separator=', ')