示例#1
0
文件: models.py 项目: tanvi-m/fjord
    def save(self, *args, **kwargs):
        # Convert emoji because emoji break MySQL
        self.description = convert_emoji(self.description)

        # Truncate the description
        self.description = self.description.strip()[:TRUNCATE_LENGTH]
        super(Response, self).save(*args, **kwargs)
示例#2
0
文件: models.py 项目: xrile/fjord
    def save(self, *args, **kwargs):
        # Convert emoji because emoji break MySQL
        self.description = convert_emoji(self.description)

        # Truncate the description
        self.description = self.description.strip()[:TRUNCATE_LENGTH]
        super(Response, self).save(*args, **kwargs)
示例#3
0
 def test_unicodedata(self):
     """Remove emoji if unicodedata2 is not installed"""
     with import_unicodedata():
         assert convert_emoji(u'Example \U0001f62a') == 'Example '
示例#4
0
 def test_sleepy_face(self):
     """Replace emoji with name if unicodedata2 is installed"""
     assert convert_emoji(u'Example \U0001f62a') == 'Example SLEEPY FACE'
示例#5
0
 def test_no_emoji(self):
     assert convert_emoji(u'Example example') == 'Example example'