Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/17227#discussion_r125204915
--- Diff: python/pyspark/sql/tests.py ---
@@ -2367,6 +2380,162 @@ def range_frame_match():
importlib.reload(window)
+
+class TypesTest(unittest.TestCase):
+
+ def test_verify_type_exception_msg(self):
+ name = "test_name"
+ try:
+ _verify_type(None, StringType(), nullable=False, name=name)
+ self.fail('Expected _verify_type() to throw so test can check
exception message')
+ except Exception as e:
+ self.assertTrue(str(e).startswith(name))
+
+ def test_verify_type_ok_nullable(self):
+ obj = None
+ for data_type in [IntegerType(), FloatType(), StringType(),
StructType([])]:
+ msg = "_verify_type(%s, %s, nullable=True)" % (obj, data_type)
+ try:
+ _verify_type(obj, data_type, nullable=True)
+ except Exception as e:
+ traceback.print_exc()
+ self.fail(msg)
+
+ def test_verify_type_not_nullable(self):
+ import array
+ import datetime
+ import decimal
+
+ MyStructType = StructType([
--- End diff --
Could we make the first character this lower-cased? (or maybe just simply
`schema`?)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]