예제 #1
0
    def test_int_types(self):
        INT_TYPES = ("Int", "Check")

        for fieldtype in INT_TYPES:
            self.assertIsInstance(cast(fieldtype, value=None), int)
            self.assertIsInstance(cast(fieldtype, value=1.12), int)
            self.assertIsInstance(cast(fieldtype, value=112), int)
예제 #2
0
 def test_str_types(self):
     STR_TYPES = ("Data", "Text", "Small Text", "Long Text", "Text Editor",
                  "Select", "Link", "Dynamic Link")
     for fieldtype in STR_TYPES:
         self.assertIsInstance(cast(fieldtype, value=None), str)
         self.assertIsInstance(cast(fieldtype, value="12-12-2021"), str)
         self.assertIsInstance(cast(fieldtype, value=""), str)
         self.assertIsInstance(cast(fieldtype, value=[]), str)
         self.assertIsInstance(cast(fieldtype, value=set()), str)
예제 #3
0
 def test_time_types(self):
     self.assertIsInstance(cast("Time", value=None), timedelta)
     self.assertIsInstance(cast("Time", value="12:03:34"), timedelta)
예제 #4
0
 def test_date_types(self):
     self.assertIsInstance(cast("Date", value=None), date)
     self.assertIsInstance(cast("Date", value="12-12-2021"), date)
예제 #5
0
 def test_datetime_types(self):
     self.assertIsInstance(cast("Datetime", value=None), datetime)
     self.assertIsInstance(cast("Datetime", value="12-2-22"), datetime)
예제 #6
0
 def test_float_types(self):
     FLOAT_TYPES = ("Currency", "Float", "Percent")
     for fieldtype in FLOAT_TYPES:
         self.assertIsInstance(cast(fieldtype, value=None), float)
         self.assertIsInstance(cast(fieldtype, value=1.12), float)
         self.assertIsInstance(cast(fieldtype, value=112), float)