示例#1
0
    def testConvertCodeToAnything(self):
        testCode = "return 0"
        x = SLRC(testCode)
        x.kind = "scalar"
        self.assertEqual(x.value, 0)

        x = SLRC(testCode)
        x.kind = "list"
        self.assertEqual(x.value, [0])

        x = SLRC(testCode)
        x.kind = "range"
        self.assertEqual(x.value, [0, 1])
示例#2
0
    def testConvertCodeToAnything(self):
        testCode = "return 0"
        x = SLRC(testCode)
        x.kind = "scalar"
        self.assertEqual(x.value, 0)

        x = SLRC(testCode)
        x.kind = "list"
        self.assertEqual(x.value, [0])

        x = SLRC(testCode)
        x.kind = "range"
        self.assertEqual(x.value, [0, 1])
示例#3
0
 def testConvertRangeToList(self):
     testRange = {'start': 0, 'end': 5, 'num': 6}
     x = SLRC(testRange)
     x.kind = 'list'
     self.assertEqual(x.value, [0, 1, 2, 3, 4, 5])
示例#4
0
 def testConvertListToCode(self):
     x = SLRC([1, 2, 3])
     x.kind = 'code'
     self.assertEqual(x(), 1)
示例#5
0
 def testConvertRangeToScalar(self):
     testRange = {'start': 0, 'end': 5, 'num': 6}
     x = SLRC(testRange)
     x.kind = 'scalar'
     self.assertEqual(x.value, 0)
示例#6
0
 def testConvertListToScalar(self):
     x = SLRC([1, 2, 3])
     x.kind = 'scalar'
     self.assertEqual(x.value, 1)
示例#7
0
 def testConvertListToRange(self):
     x = SLRC([1, 4, 5])
     x.kind = 'range'
     self.assertEqual(x.value, [1, 3, 5])
示例#8
0
 def testConvertScalarToRange(self):
     x = SLRC(5)
     x.kind = 'range'
     self.assertEqual(x.value, [5])
示例#9
0
 def testConvertScalarToCode(self):
     x = SLRC(5)
     x.kind = 'code'
     self.assertEqual(x(), 5)
示例#10
0
 def testConvertRangeToCode(self):
     testRange = {'start': 0, 'end': 5, 'num': 6}
     x = SLRC(testRange)
     x.kind = 'code'
     self.assertEqual(x(), 0)
示例#11
0
 def testConvertScalarToRange(self):
     x = SLRC(5)
     x.kind = 'range'
     self.assertEqual(x.value, [5])
示例#12
0
 def testConvertRangeToList(self):
     testRange = {'start': 0, 'end': 5, 'num': 6}
     x = SLRC(testRange)
     x.kind = 'list'
     self.assertEqual(x.value, [0, 1, 2, 3, 4, 5])
示例#13
0
 def testConvertRangeToCode(self):
     testRange = {'start': 0, 'end': 5, 'num': 6}
     x = SLRC(testRange)
     x.kind = 'code'
     self.assertEqual(x(), 0)
示例#14
0
 def testConvertRangeToScalar(self):
     testRange = {'start': 0, 'end': 5, 'num': 6}
     x = SLRC(testRange)
     x.kind = 'scalar'
     self.assertEqual(x.value, 0)
示例#15
0
 def testConvertListToCode(self):
     x = SLRC([1, 2, 3])
     x.kind = 'code'
     self.assertEqual(x(), 1)
示例#16
0
 def testConvertListToRange(self):
     x = SLRC([1, 4, 5])
     x.kind = 'range'
     self.assertEqual(x.value, [1, 3, 5])
示例#17
0
 def testConvertListToScalar(self):
     x = SLRC([1, 2, 3])
     x.kind = 'scalar'
     self.assertEqual(x.value, 1)
示例#18
0
 def testConvertScalarToCode(self):
     x = SLRC(5)
     x.kind = 'code'
     self.assertEqual(x(), 5)
示例#19
0
 def testConvertScalarToList(self):
     x = SLRC(5)
     x.kind = 'list'
     self.assertEqual(x.value, [5])
示例#20
0
 def testConvertScalarToList(self):
     x = SLRC(5)
     x.kind = 'list'
     self.assertEqual(x.value, [5])