Skip to content

Commit

Permalink
[AIRFLOW-2796] Improve utils helpers code coverage (apache#3637)
Browse files Browse the repository at this point in the history
  • Loading branch information
andscoop authored and Tao Feng committed Aug 5, 2018
1 parent 33dd33c commit 012ebfd
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/utils/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,43 @@ def test_reduce_in_chunks(self):
2),
14)

def test_is_in(self):
obj = ["list", "object"]
# Check for existence of a list object within a list
self.assertTrue(
helpers.is_in(obj, [obj])
)

# Check that an empty list returns false
self.assertFalse(
helpers.is_in(obj, [])
)

# Check to ensure it handles None types
self.assertFalse(
helpers.is_in(None, [obj])
)

# Check to ensure true will be returned of multiple objects exist
self.assertTrue(
helpers.is_in(obj, [obj, obj])
)

def test_is_container(self):
self.assertFalse(helpers.is_container("a string is not a container"))
self.assertTrue(helpers.is_container(["a", "list", "is", "a", "container"]))

def test_as_tuple(self):
self.assertEquals(
helpers.as_tuple("a string is not a container"),
("a string is not a container",)
)

self.assertEquals(
helpers.as_tuple(["a", "list", "is", "a", "container"]),
("a", "list", "is", "a", "container")
)


class HelpersTest(unittest.TestCase):
def test_as_tuple_iter(self):
Expand Down

0 comments on commit 012ebfd

Please sign in to comment.