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 ('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())
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())
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())