Skip to content

Instantly share code, notes, and snippets.

@afranzi
Created January 31, 2019 14:48
Show Gist options
  • Save afranzi/e70ab96cbd81de1566aa744879eda5ca to your computer and use it in GitHub Desktop.
Save afranzi/e70ab96cbd81de1566aa744879eda5ca to your computer and use it in GitHub Desktop.
from unittest import TestCase
from our_package import to_upper
class TestUDFs(TestCase):
def test_upper(self):
"""
# Case 1 - Lambda
to_upper = udf(lambda s: s.upper() if s else None, StringType())
"""
self.assertEqual(to_upper('potato'), 'POTATO')
self.assertEqual(to_upper(None), None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment