You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2018/08/05 00:53:24 UTC

[GitHub] feng-tao closed pull request #3637: [AIRFLOW-2796] Improve utils helpers code coverage

feng-tao closed pull request #3637: [AIRFLOW-2796] Improve utils helpers code coverage
URL: https://github.com/apache/incubator-airflow/pull/3637
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/tests/utils/test_helpers.py b/tests/utils/test_helpers.py
index 1005671e9e..5fa941c55d 100644
--- a/tests/utils/test_helpers.py
+++ b/tests/utils/test_helpers.py
@@ -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")
+        )
+
 
 if __name__ == '__main__':
     unittest.main()


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services