From 71f57b805bb7a5a92da812b934c540b0aa5d5b8e Mon Sep 17 00:00:00 2001 From: Henrique Souza Date: Fri, 24 Jun 2016 17:05:01 -0300 Subject: [PATCH] Covering remaining code of conf class --- dummy_spark/conf.py | 5 ++++- tests/unit/test_conf.py | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dummy_spark/conf.py b/dummy_spark/conf.py index 0479a63..622c2d7 100644 --- a/dummy_spark/conf.py +++ b/dummy_spark/conf.py @@ -5,6 +5,9 @@ class SparkConf(object): + + DEBUG_STRING = 'no string for dummy version' + def __init__(self, loadDefaults=True, _jvm=None, _jconf=None): self.conf = {} @@ -58,4 +61,4 @@ def contains(self, key): return key in self.conf.keys() def toDebugString(self): - return 'no string for dummy version' + return self.DEBUG_STRING diff --git a/tests/unit/test_conf.py b/tests/unit/test_conf.py index 004fa1d..4dffbc0 100644 --- a/tests/unit/test_conf.py +++ b/tests/unit/test_conf.py @@ -35,6 +35,8 @@ def test_set_if_missing(self): conf.set(self.RANDOM_KEY, self.RANDOM_VALUE) conf.setIfMissing(self.RANDOM_KEY, self.RANDOM_VALUE2) self.assertEquals(conf.get(self.RANDOM_KEY), self.RANDOM_VALUE) + conf.setIfMissing(self.RANDOM_KEY2, self.RANDOM_VALUE2) + self.assertEquals(conf.get(self.RANDOM_KEY2), self.RANDOM_VALUE2) def test_set_executor_env1(self): conf = SparkConf() @@ -75,3 +77,7 @@ def test_get_all(self): (self.RANDOM_KEY2, self.RANDOM_VALUE2)] conf.setAll(pairs) self.assertEquals(sorted(conf.getAll()), sorted(pairs)) + + def test_to_debug_string(self): + conf = SparkConf() + self.assertEquals(conf.toDebugString(), SparkConf.DEBUG_STRING)