def setUp(self):
     self.domain = AllowedRangeCollection(
         AllowedRange(None, -5.0, 'open'),
         AllowedRange(6.0, None, spacing=3.0),
         AllowedEnum(xrange(-4, 0)),
         AllowedEnum(range(0, 6, 2)),
     )
     self.accepted = ['-inf', -100., -3, 2, 6, 300]
     self.rejected = ['nan', '+inf', 7, 3, -0.5, -5]
Beispiel #2
0
 def setUp(self):
     try:
         # Python 2
         xrange
     except NameError:
         # Python 3, xrange is now named range
         xrange = range
     self.domain = AllowedRangeCollection(
         AllowedRange(None, -5.0, 'open'),
         AllowedRange(6.0, None, spacing=3.0),
         AllowedEnum(xrange(-4, 0)),
         AllowedEnum(range(0, 6, 2)),
     )
     self.accepted = ['-inf', -100., -3, 2, 6, 300]
     self.rejected = ['nan', '+inf', 7, 3, -0.5, -5]
Beispiel #3
0
 def setUp(self):
     vlist = [
         '2014-01-01T09:30:21Z',
         '2014-02-01T18:20:15Z',
         '2014-03-01T12:15:02Z',
     ]
     self.domain = AllowedEnum(vlist, dtype=datetime)
     self.accepted = [vlist[1], DateTime.parse(vlist[0])]
     self.rejected = [DateTime.parse('2014-01-01T12:30:00Z')]
Beispiel #4
0
 def setUp(self):
     self.domain = AllowedEnum([0.0, 0.5, 1.0], dtype=Double)
     self.accepted = [1.0, 0]
     self.rejected = [-1]
Beispiel #5
0
 def setUp(self):
     vlist = ['P1Y', 'P26DT1M', 'PT25M16S']
     self.domain = AllowedEnum(vlist, dtype=timedelta)
     self.accepted = [vlist[1], Duration.parse(vlist[0])]
     self.rejected = [Duration.parse('P7DT15H8M')]
Beispiel #6
0
 def setUp(self):
     vlist = ['05:30', '08:20', '16:18']
     self.domain = AllowedEnum(vlist, dtype=time)
     self.accepted = [vlist[1], Time.parse(vlist[0])]
     self.rejected = [Time.parse('19:20')]
Beispiel #7
0
 def setUp(self):
     vlist = ['2014-01-01', '2014-02-01', '2014-03-01']
     self.domain = AllowedEnum(vlist, dtype=date)
     self.accepted = [vlist[1], Date.parse(vlist[0])]
     self.rejected = [Date.parse('2014-01-02')]
Beispiel #8
0
 def setUp(self):
     enum = ['John', 'James', 'Jeffrey', 'Jacob', 'Jerry']
     self.domain = AllowedEnum(enum, dtype=text_type)
     self.accepted = ['John', 'Jacob', 'Jerry']
     self.rejected = ['Alex', '']
Beispiel #9
0
 def setUp(self):
     self.domain = AllowedEnum([0, 2, 3], dtype=int)
     self.accepted = [2, 0]
     self.rejected = [1]