import unittest
import rangetools

class TestRange(unittest.TestCase):
    def setUp(self):
        pass

    def test_basic_range(self):
        # integer start integer stop, ascending step by one
        rng = rangetools.Range(0,2,1)
        items = [x for x in rng]
        self.assertEquals(items, [0, 1, 2])

        # integer start float stop, ascending step by one
        rng = rangetools.Range(-1, .5, 1)
        items = [x for x in rng]
        self.assertEquals(items, [-1, 0])

        # float start float stop, ascending step by one
        rng = rangetools.Range(.5, 2.5, 1)
        items = [x for x in rng]
        self.assertEquals(items, [0.5, 1.5, 2.5])

        # First step is outside bounds.
        rng = rangetools.Range(0, 1, -1)
        items = [x for x in rng]
        self.assertEquals(items, [0])

    def test_range_wrap(self):
        rng = rangetools.Range(0, 2, 1, repeat=2, wrap=True)
        items = [x for x in rng]
        self.assertEquals(items, [0, 1, 2, 0, 1, 2])

        rng = rangetools.Range(0, 1, .4, repeat=2, wrap=True)
        items = [x for x in rng]
        self.assertEquals(items, [0, 0.4, 0.8, 0.2, 0.6, 1.0])

@@ -9,22 +9,20 @@
 nittest%0A
-import
+from
  rangeto
@@ -24,16 +24,29 @@
 ngetools
+ import Range
 %0A%0Aclass 
@@ -134,32 +134,296 @@
 ic_range(self):%0A
+        # Only start argument%0A        rng = Range(2.3)%0A        items = %5Bx for x in rng%5D%0A        self.assertEquals(items, %5B2.3%5D)%0A%0A        # start equals stop%0A        rng = Range(-1.3, -1.3)%0A        items = %5Bx for x in rng%5D%0A        self.assertEquals(items, %5B-1.3%5D)%0A%0A
         # intege
@@ -476,35 +476,24 @@
       rng = 
-rangetools.
 Range(0,2,1)
@@ -639,35 +639,24 @@
       rng = 
-rangetools.
 Range(-1, .5
@@ -802,35 +802,24 @@
       rng = 
-rangetools.
 Range(.5, 2.
@@ -904,24 +904,315 @@
 1.5, 2.5%5D)%0A%0A
+        # float step%0A        rng = Range(1, 2, .3)%0A        items = %5Bx for x in rng%5D%0A        self.assertEquals(items, %5B1, 1.3, 1.6, 1.9%5D)%0A%0A        # negative float step%0A        rng = Range(10, 8.5, -0.5)%0A        items = %5Bx for x in rng%5D%0A        self.assertEquals(items, %5B10, 9.5, 9.0, 8.5%5D)%0A%0A
         # Fi
@@ -1249,35 +1249,24 @@
       rng = 
-rangetools.
 Range(0, 1, 
@@ -1380,33 +1380,50 @@
         
-rng = rangetools.
+# Integer step wrap%0A        rng = 
 Range(0,
@@ -1529,32 +1529,58 @@
 , 2, 0, 1, 2%5D)%0A%0A
+        # Float step wrap%0A
         rng = ra
@@ -1581,24 +1581,13 @@
 g = 
-r
+R
 ange
-tools.Range
 (0, 
@@ -1706,12 +1706,465 @@
  0.6
+, 1.0%5D)%0A%0A        # all float wrap, descending step hits start%0A        rng = Range(10.1, 9.3, -.2, repeat=2, wrap=True)%0A        items = %5Bx for x in rng%5D%0A        self.assertEquals(items, %5B10.1, 9.9, 9.7, 9.5, 9.3, 9.9, 9.7, 9.5, 9.3%5D)%0A%0A        # all float wrap, descending step does not hit start%0A        rng = Range(10.1, 9.3, -.3, repeat=2, wrap=True)%0A        items = %5Bx for x in rng%5D%0A        self.assertEquals(items, %5B10.1, 9.8, 9.5
 , 1
+0
 .0
-%5D)
+, 9.7, 9.4%5D)%0A%0A       
 %0A

add more Range wrap tests