def test_A_Breathing(self):

        # test we can convert unicode to unicode
        phlsys_textconvert.to_unicode(unicode('hello'))

        # test we can convert str to unicode
        self.assertIsInstance(phlsys_textconvert.to_unicode('hello'), unicode)

        # test invalid characters get replaced by the replacement character
        self.assertEqual(phlsys_textconvert.to_unicode('\xFF'), u'\uFFFD')

        # test 'horizontal ellipses' as UTF8 get replaced
        self.assertEqual(phlsys_textconvert.to_unicode('\xe2\x80\xa6'),
                         u'\uFFFD\uFFFD\uFFFD')

        # test we can convert ascii to ascii
        phlsys_textconvert.ensure_ascii('hello')

        # test str stays str
        self.assertIsInstance(phlsys_textconvert.ensure_ascii('hello'), str)

        # test invalid characters get replaced by '?'
        self.assertEqual(phlsys_textconvert.ensure_ascii('\xFF'), '?')

        # test 'horizontal ellipses' as UTF8 get replaced
        self.assertEqual(phlsys_textconvert.ensure_ascii('\xe2\x80\xa6'),
                         '???')
Ejemplo n.º 2
0
    def parse_commit_message(self, message):
        """Return a ParseCommitMessageResponse based on 'message'.

        :message: a string message to parse
        :returns: a phlcon_differential.ParseCommitMessageResponse

        """
        message = phlsys_textconvert.to_unicode(message)
        return phlcon_differential.parse_commit_message(self._conduit, message)
Ejemplo n.º 3
0
    def parse_commit_message(self, message):
        """Return a ParseCommitMessageResponse based on 'message'.

        :message: a string message to parse
        :returns: a phlcon_differential.ParseCommitMessageResponse

        """
        message = phlsys_textconvert.to_unicode(message)
        return phlcon_differential.parse_commit_message(
            self._multi_conduit, message)
    def test_A_Breathing(self):

        # test we can convert unicode to unicode
        phlsys_textconvert.to_unicode(unicode('hello'))

        # test we can convert str to unicode
        self.assertIsInstance(
            phlsys_textconvert.to_unicode('hello'),
            unicode)

        # test invalid characters get replaced by the replacement character
        self.assertEqual(
            phlsys_textconvert.to_unicode('\xFF'),
            u'\uFFFD')

        # test 'horizontal ellipses' as UTF8 get replaced
        self.assertEqual(
            phlsys_textconvert.to_unicode('\xe2\x80\xa6'),
            u'\uFFFD\uFFFD\uFFFD')

        # test we can convert ascii to ascii
        phlsys_textconvert.ensure_ascii('hello')

        # test str stays str
        self.assertIsInstance(
            phlsys_textconvert.ensure_ascii('hello'),
            str)

        # test invalid characters get replaced by '?'
        self.assertEqual(
            phlsys_textconvert.ensure_ascii('\xFF'),
            '?')

        # test 'horizontal ellipses' as UTF8 get replaced
        self.assertEqual(
            phlsys_textconvert.ensure_ascii('\xe2\x80\xa6'),
            '???')