Ejemplo n.º 1
0
 def test_repeated_int(self):
     inference = pa.infer_column_type(REPEATED_INT_LIST, False)
     self.assertDictEqual(
         inference, {
             "detected_type": "integer",
             "nullable": False,
             "null_values": (),
             "choices": (),
             "max_length": -1,
             "is_key": False,
             "include_alternate": False,
             "max_seen_decimals": -1
         })
Ejemplo n.º 2
0
 def test_unique_int_inference_with_existing_key(self):
     inference = pa.infer_column_type(UNIQUE_INT_LIST, True)
     self.assertDictEqual(
         inference, {
             "detected_type": "integer",
             "nullable": False,
             "null_values": (),
             "choices": (),
             "max_length": -1,
             "is_key": False,
             "include_alternate": False,
             "max_seen_decimals": -1
         })
Ejemplo n.º 3
0
 def test_manual_key_inference(self):
     inference = pa.infer_column_type(UNIQUE_INT_LIST, False)
     self.assertDictEqual(
         inference, {
             "detected_type": "manual key",
             "nullable": False,
             "null_values": (),
             "choices": (),
             "max_length": -1,
             "is_key": True,
             "include_alternate": False,
             "max_seen_decimals": -1
         })
Ejemplo n.º 4
0
 def test_nullable_int(self):
     inference = pa.infer_column_type(NULL_INT_LIST, True)
     self.assertDictEqual(
         inference,
         {
             "detected_type": "integer",
             "nullable": True,
             "null_values": (),  # TODO: DO WE WANT NULL VALUES HERE?
             "choices": (),
             "max_length": -1,
             "is_key": False,
             "include_alternate": False,
             "max_seen_decimals": -1
         })
Ejemplo n.º 5
0
 def test_consistent_decimal(self):
     inference = pa.infer_column_type(UNIQUE_CONSISTENT_DECIMAL_LIST, True)
     self.assertDictEqual(
         inference,
         {
             "detected_type": "decimal",
             "nullable": False,
             "null_values": (),
             "choices": (),
             "max_length":
             11,  # 4 digits + decimal point + 2 digits after decimal + (constant 4) TODO: good formula?
             "is_key": False,
             "include_alternate": False,
             "max_seen_decimals": 2
         })
Ejemplo n.º 6
0
 def test_mix_of_ints_and_decimals(self):
     inference = pa.infer_column_type(MIXED_INTS_AND_DECIMALS, True)
     self.assertDictEqual(
         inference,
         {
             "detected_type": "decimal",
             "nullable": False,
             "null_values": (),
             "choices": (),
             "max_length":
             12,  # 4 digits + decimal point + 3 digits after decimal + (constant 4) TODO: good formula?
             "is_key": False,
             "include_alternate": False,
             "max_seen_decimals": 3
         })