コード例 #1
0
    def test_change_case(self):
        ' Test the various ways of changing the case '
        from calibre.utils.titlecase import titlecase
        # Test corner cases
        self.ae('A', icu.upper(b'a'))
        for x in ('', None, False, 1):
            self.ae(x, icu.capitalize(x))

        for x in ('a', 'Alice\'s code', 'macdonald\'s machIne', '02 the wars'):
            self.ae(icu.upper(x), x.upper())
            self.ae(icu.lower(x), x.lower())
            # ICU's title case algorithm is different from ours, when there are
            # capitals inside words
            self.ae(icu.title_case(x), titlecase(x).replace('machIne', 'Machine'))
            self.ae(icu.capitalize(x), x[0].upper() + x[1:].lower())
            self.ae(icu.swapcase(x), x.swapcase())
コード例 #2
0
ファイル: icu_test.py プロジェクト: MarioJC/calibre
    def test_change_case(self):
        ' Test the various ways of changing the case '
        from calibre.utils.titlecase import titlecase
        # Test corner cases
        self.ae('A', icu.upper(b'a'))
        for x in ('', None, False, 1):
            self.ae(x, icu.capitalize(x))

        for x in ('a', 'Alice\'s code', 'macdonald\'s machIne', '02 the wars'):
            self.ae(icu.upper(x), x.upper())
            self.ae(icu.lower(x), x.lower())
            # ICU's title case algorithm is different from ours, when there are
            # capitals inside words
            self.ae(icu.title_case(x), titlecase(x).replace('machIne', 'Machine'))
            self.ae(icu.capitalize(x), x[0].upper() + x[1:].lower())
            self.ae(icu.swapcase(x), x.swapcase())
コード例 #3
0
 def swap_case(self):
     self.push_history()
     from calibre.utils.icu import swapcase
     for item in self.selectedItems():
         t = unicode_type(item.data(0, Qt.DisplayRole) or '')
         item.setData(0, Qt.DisplayRole, swapcase(t))
コード例 #4
0
ファイル: widgets.py プロジェクト: zdndanny/calibre
 def swap_case(self):
     from calibre.utils.icu import swapcase
     self.setText(swapcase(unicode_type(self.text())))
コード例 #5
0
ファイル: main.py プロジェクト: j-howell/calibre
 def swap_case(self):
     self.push_history()
     from calibre.utils.icu import swapcase
     for item in self.selectedItems():
         t = unicode_type(item.data(0, Qt.DisplayRole) or '')
         item.setData(0, Qt.DisplayRole, swapcase(t))
コード例 #6
0
ファイル: widgets.py プロジェクト: JimmXinu/calibre
 def swap_case(self):
     from calibre.utils.icu import swapcase
     self.setText(swapcase(unicode_type(self.text())))
コード例 #7
0
ファイル: widgets.py プロジェクト: smdx023/calibre
 def swap_case(self):
     from calibre.utils.icu import swapcase
     self.setText(swapcase(str(self.text())))