Exemple #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])
Exemple #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])
Exemple #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])
Exemple #4
0
 def testConvertListToCode(self):
     x = SLRC([1, 2, 3])
     x.kind = 'code'
     self.assertEqual(x(), 1)
Exemple #5
0
 def testConvertRangeToScalar(self):
     testRange = {'start': 0, 'end': 5, 'num': 6}
     x = SLRC(testRange)
     x.kind = 'scalar'
     self.assertEqual(x.value, 0)
Exemple #6
0
 def testConvertListToScalar(self):
     x = SLRC([1, 2, 3])
     x.kind = 'scalar'
     self.assertEqual(x.value, 1)
Exemple #7
0
 def testConvertListToRange(self):
     x = SLRC([1, 4, 5])
     x.kind = 'range'
     self.assertEqual(x.value, [1, 3, 5])
Exemple #8
0
 def testConvertScalarToRange(self):
     x = SLRC(5)
     x.kind = 'range'
     self.assertEqual(x.value, [5])
Exemple #9
0
 def testConvertScalarToCode(self):
     x = SLRC(5)
     x.kind = 'code'
     self.assertEqual(x(), 5)
Exemple #10
0
 def testConvertRangeToCode(self):
     testRange = {'start': 0, 'end': 5, 'num': 6}
     x = SLRC(testRange)
     x.kind = 'code'
     self.assertEqual(x(), 0)
Exemple #11
0
 def testConvertScalarToRange(self):
     x = SLRC(5)
     x.kind = 'range'
     self.assertEqual(x.value, [5])
Exemple #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])
Exemple #13
0
 def testConvertRangeToCode(self):
     testRange = {'start': 0, 'end': 5, 'num': 6}
     x = SLRC(testRange)
     x.kind = 'code'
     self.assertEqual(x(), 0)
Exemple #14
0
 def testConvertRangeToScalar(self):
     testRange = {'start': 0, 'end': 5, 'num': 6}
     x = SLRC(testRange)
     x.kind = 'scalar'
     self.assertEqual(x.value, 0)
Exemple #15
0
 def testConvertListToCode(self):
     x = SLRC([1, 2, 3])
     x.kind = 'code'
     self.assertEqual(x(), 1)
Exemple #16
0
 def testConvertListToRange(self):
     x = SLRC([1, 4, 5])
     x.kind = 'range'
     self.assertEqual(x.value, [1, 3, 5])
Exemple #17
0
 def testConvertListToScalar(self):
     x = SLRC([1, 2, 3])
     x.kind = 'scalar'
     self.assertEqual(x.value, 1)
Exemple #18
0
 def testConvertScalarToCode(self):
     x = SLRC(5)
     x.kind = 'code'
     self.assertEqual(x(), 5)
Exemple #19
0
 def testConvertScalarToList(self):
     x = SLRC(5)
     x.kind = 'list'
     self.assertEqual(x.value, [5])
Exemple #20
0
 def testConvertScalarToList(self):
     x = SLRC(5)
     x.kind = 'list'
     self.assertEqual(x.value, [5])