コード例 #1
0
 def test_xrange_list1(self):
     self.assertEqual(list(xrange(0, 10, 2)), [0, 2, 4, 6, 8])
コード例 #2
0
 def test_xrange_list(self):
     self.assertEqual(list(xrange(0, 10)), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
コード例 #3
0
 def test_exception3(self):
     with self.assertRaises(ValueError):
         print(list(xrange(122, -10, 0)))
コード例 #4
0
 def test_xrange_yan2(self):
     self.assertEqual(list(xrange(-10)), list(range(-10)))
コード例 #5
0
 def test_xrange_yan3(self):
     self.assertEqual(list(xrange(-10, -20, -1)), list(range(-10, -20, -1)))
コード例 #6
0
 def test_xrange_list5(self):
     self.assertEqual(list(xrange(10, 0, -1)),
                      [10, 9, 8, 7, 6, 5, 4, 3, 2, 1])
コード例 #7
0
 def test_xrange_yan1(self):
     self.assertEqual(list(xrange(10, 2)), list(range(10, 2)))
コード例 #8
0
 def test_exception2(self):
     with self.assertRaises(TypeError):
         print(list(xrange(0, 10, 2, 2)))
コード例 #9
0
 def test_exception1(self):
     with self.assertRaises(TypeError):
         print(list(xrange(0, 1, 0.1)))
コード例 #10
0
 def test_xrange_join(self):
     self.assertEqual(",".join(str(i) for i in xrange(0, 10)),
                      "0,1,2,3,4,5,6,7,8,9")
コード例 #11
0
 def test_xrange_single(self):
     self.assertEqual(list(xrange(1, 1)), [])
コード例 #12
0
 def test_xrange_list2(self):
     self.assertEqual(list(xrange(-10, 0)),
                      [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1])