本文整理汇总了Python中HW1类的典型用法代码示例。如果您正苦于以下问题:Python HW1类的具体用法?Python HW1怎么用?Python HW1使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HW1类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_reverse_2
def test_reverse_2(self):
txt = HW1.reverse("spoons")
rtxt = "spoons"
print "If I reverse %s, I get %s. :)" % (rtxt, txt)
tmp = 1
for i in range(len(txt)):
self.assertEqual(txt[i], rtxt[-tmp])
tmp += 1
示例2: test_reversewordsone
def test_reversewordsone(self):
self.assertEqual(HW1.reversewords("Test one."), "one Test.")
示例3: test_reversetwo
def test_reversetwo(self):
self.assertEqual(HW1.reverse("Punctuation test..."), "...tset noitautcnuP")
示例4: test_reversewordstwo
def test_reversewordstwo(self):
self.assertEqual(HW1.reversewords("Punctuation test..."), "test... Punctuation.")
示例5: test_shoutone
def test_shoutone(self):
self.assertEqual(HW1.shout("Hello"), "HELLO!") # One word
示例6: test_reversewordlettersone
def test_reversewordlettersone(self):
self.assertEqual(HW1.reversewordletters("This is a test."), "sihT si a tset.")
示例7: test_reversewordletterstwo
def test_reversewordletterstwo(self):
self.assertEqual(
HW1.reversewordletters("This sentence has a lot of words."), "sihT ecnetnes sah a tol fo sdrow."
)
示例8: test_reverseone
def test_reverseone(self):
self.assertEqual(HW1.reverse("Test one"), "eno tseT") # basic reversal
示例9: test_shout4
def test_shout4(self):
self.assertEqual(HW1.shout("Hey. You!"), "HEY! YOU!")
示例10: test_reversewords1
def test_reversewords1(self):
self.assertEqual(HW1.reversewords("Hi, my name is Blah."), "Blah is name my, Hi.")
示例11: test_reversewordletters_string
def test_reversewordletters_string(self):
self.assertEqual(HW1.reversewordletters("A civic testset is nice."), "A civic testset si ecin.")
示例12: test_reversewords_string
def test_reversewords_string(self):
self.assertEqual(HW1.reversewords("Hello world."), "world Hello.")
示例13: stest_shoutfive
def stest_shoutfive(self):
self.assertEqual(
HW1.shout("Multiple periods..."), "MULTIPLE PERIODS!!!"
) # turn punctuation into exclaimation =
示例14: test_shoutfour
def test_shoutfour(self):
self.assertEqual(HW1.shout("CAPS?"), "CAPS!!") # Already in caps, add a different punctuation
示例15: test_shoutthree
def test_shoutthree(self):
self.assertEqual(HW1.shout("Exclaimed Hello!!!"), "EXCLAIMED HELLO!!!!") # Punctuation