コード例 #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
コード例 #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"))
コード例 #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())
コード例 #4
0
 def test_try_incompatible_type(self):
     arr = pa.array(TypedSequence(["foo", "bar"], try_type=pa.int64()))
     self.assertEqual(arr.type, pa.string())
コード例 #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")))
コード例 #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())
コード例 #7
0
 def test_incompatible_type(self):
     with self.assertRaises((TypeError, pa.lib.ArrowInvalid)):
         _ = pa.array(TypedSequence(["foo", "bar"], type=pa.int64()))
コード例 #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()))
コード例 #9
0
 def test_array_type_forbidden(self):
     with self.assertRaises(AssertionError):
         _ = pa.array(TypedSequence([1, 2, 3]), type=pa.int64())
コード例 #10
0
 def test_no_type(self):
     arr = pa.array(TypedSequence([1, 2, 3]))
     self.assertEqual(arr.type, pa.int64())