Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22762#discussion_r226267706
  
    --- Diff: python/pyspark/sql/tests.py ---
    @@ -225,6 +225,55 @@ def sql_conf(self, pairs):
                     else:
                         self.spark.conf.set(key, old_value)
     
    +    @contextmanager
    +    def database(self, *databases):
    +        """
    +        A convenient context manager to test with some specific databases. 
This drops the given
    +        databases if exist and sets current database to "default" when it 
exits.
    +        """
    +        assert hasattr(self, "spark"), "it should have 'spark' attribute, 
having a spark session."
    +
    +        if len(databases) == 1 and isinstance(databases[0], (list, set)):
    --- End diff --
    
    like .. an assert by this condition `all(map(lambda d: isinstance(d, str), 
databases))` should be good enough.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to