示例#1
0
 def test_sstr(self):
     s1 = sstr("abcde")
     self.assertEqual(s1 >> 0, sstr("abcde"))
     self.assertEqual(s1 << 0, sstr("abcde"))
     self.assertEqual(s1 << 2, sstr("cdeab"))
     self.assertEqual(s1 >> 2, sstr("deabc"))
     self.assertEqual(s1 >> 5, sstr("abcde"))
     self.assertTrue((s1 >> 5) << 5 == sstr("abcde"))
     s2 = sstr("abcdefghijlkmnopqrst")
     self.assertEqual(s2 >> 10, sstr("lkmnopqrstabcdefghij"))
示例#2
0
文件: test_sstr.py 项目: rwehner/rl
 def test_sstr(self):
     s1 = sstr("abcde")
     self.assertEqual(s1 << 0, 'abcde')
     self.assertEqual(s1 >> 0, 'abcde')
     self.assertEqual(s1 << 2, 'cdeab')
     self.assertEqual(s1 >> 2, 'deabc')
     self.assertEqual(s1 >> 5, 'abcde')
     self.assertTrue((s1 >> 5) << 5 == 'abcde')
示例#3
0
 def test_sstr(self):
     s1 = sstr("abcde")
     self.assertTrue(s1 << 0 == 'abcde', "'abcde' is expected")
     self.assertTrue(s1 >> 0 == 'abcde', "'abcde' is expected")
     self.assertTrue(s1 << 2 == 'cdeab', "'cdeab' is expected")
     self.assertTrue(s1 >> 2 == 'deabc', "'cdeab' is expected")
     self.assertTrue(s1 >> 5 == 'abcde', "'abcde' is expected")
     self.assertTrue((s1 >> 5) << 5 == 'abcde', "'abcde' is expected")
示例#4
0
 def test_sstr(self):
     s1 = sstr("abcde")
     self.assertTrue(s1 << 0 == "abcde", "'abcde' is expected")
     self.assertTrue(s1 >> 0 == "abcde", "'abcde' is expected")
     self.assertTrue(s1 << 2 == "cdeab", "'cdeab' is expected")
     self.assertTrue(s1 >> 2 == "deabc", "'cdeab' is expected")
     self.assertTrue(s1 >> 5 == "abcde", "'abcde' is expected")
     self.assertTrue((s1 >> 5) << 5 == "abcde", "'abcde' is expected")
示例#5
0
 def test_sstr(self):
     s1 = sstr("abcde")
     actual = s1 << 0
     expected = "abcde"
     self.assertEqual(actual, expected)
     actual = s1 >> 0
     self.assertEqual(actual, expected)
     actual = s1 >> 5
     self.assertEqual(actual, expected)
     actual = s1 << 2
     expected = "cdeab"
     self.assertEqual(actual, expected)
     actual = s1 >> 2
     expected = "deabc"
     self.assertEqual(actual, expected)
     actual = (s1 >> 5) << 5 == "abcde"
     expected = True
     self.assertEqual(actual, expected)
示例#6
0
 def setUp(self):
     self.s1 = sstr('abcde')