Esempio n. 1
0
 def test_catch_overflow(self):
     with self.assertRaises(OverflowError):
         _ = pa.array(TypedSequence(
             [["x" * 1024]] *
             ((2 << 20) + 1)))  # ListArray with a bit more than 2GB
Esempio n. 2
0
 def test_try_compatible_extension_type(self):
     arr = pa.array(
         TypedSequence([[[1, 2, 3]]],
                       try_type=Array2DExtensionType((1, 3), "int64")))
     self.assertEqual(arr.type, Array2DExtensionType((1, 3), "int64"))
Esempio n. 3
0
 def test_try_incompatible_extension_type(self):
     arr = pa.array(
         TypedSequence(["foo", "bar"],
                       try_type=Array2DExtensionType((1, 3), "int64")))
     self.assertEqual(arr.type, pa.string())
Esempio n. 4
0
 def test_try_incompatible_type(self):
     arr = pa.array(TypedSequence(["foo", "bar"], try_type=pa.int64()))
     self.assertEqual(arr.type, pa.string())
Esempio n. 5
0
 def test_incompatible_extension_type(self):
     with self.assertRaises((TypeError, pa.lib.ArrowInvalid)):
         _ = pa.array(
             TypedSequence(["foo", "bar"],
                           type=Array2DExtensionType((1, 3), "int64")))
Esempio n. 6
0
 def test_try_compatible_type(self):
     arr = pa.array(TypedSequence([1, 2, 3], try_type=pa.int32()))
     self.assertEqual(arr.type, pa.int32())
Esempio n. 7
0
 def test_incompatible_type(self):
     with self.assertRaises((TypeError, pa.lib.ArrowInvalid)):
         _ = pa.array(TypedSequence(["foo", "bar"], type=pa.int64()))
Esempio n. 8
0
 def test_try_type_and_type_forbidden(self):
     with self.assertRaises(AssertionError):
         _ = pa.array(
             TypedSequence([1, 2, 3], try_type=pa.bool_(), type=pa.int64()))
Esempio n. 9
0
 def test_array_type_forbidden(self):
     with self.assertRaises(AssertionError):
         _ = pa.array(TypedSequence([1, 2, 3]), type=pa.int64())
Esempio n. 10
0
 def test_no_type(self):
     arr = pa.array(TypedSequence([1, 2, 3]))
     self.assertEqual(arr.type, pa.int64())