Repository: beam Updated Branches: refs/heads/master 2cf68730c -> 37e532188
Add ValueProvider tests to json_value_test.py Project: http://git-wip-us.apache.org/repos/asf/beam/repo Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/5e62e6fd Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/5e62e6fd Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/5e62e6fd Branch: refs/heads/master Commit: 5e62e6fdde38e574895b1dc0189f431a10e3cbc0 Parents: 2cf6873 Author: Maria Garcia Herrero <[email protected]> Authored: Sun Apr 23 21:22:35 2017 -0700 Committer: Ahmet Altay <[email protected]> Committed: Mon Apr 24 11:13:12 2017 -0700 ---------------------------------------------------------------------- sdks/python/apache_beam/internal/gcp/json_value_test.py | 11 +++++++++++ sdks/python/apache_beam/utils/pipeline_options_test.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/beam/blob/5e62e6fd/sdks/python/apache_beam/internal/gcp/json_value_test.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/internal/gcp/json_value_test.py b/sdks/python/apache_beam/internal/gcp/json_value_test.py index 647ae66..a61c50b 100644 --- a/sdks/python/apache_beam/internal/gcp/json_value_test.py +++ b/sdks/python/apache_beam/internal/gcp/json_value_test.py @@ -21,6 +21,8 @@ import unittest from apache_beam.internal.gcp.json_value import from_json_value from apache_beam.internal.gcp.json_value import to_json_value +from apache_beam.utils.value_provider import StaticValueProvider +from apache_beam.utils.value_provider import RuntimeValueProvider # Protect against environments where apitools library is not available. @@ -50,6 +52,15 @@ class JsonValueTest(unittest.TestCase): def test_float_to(self): self.assertEquals(JsonValue(double_value=2.75), to_json_value(2.75)) + def test_static_value_provider_to(self): + svp = StaticValueProvider(str, 'abc') + self.assertEquals(JsonValue(string_value=svp.value), to_json_value(svp)) + + def test_runtime_value_provider_to(self): + RuntimeValueProvider.runtime_options = None + rvp = RuntimeValueProvider('arg', 123, int) + self.assertEquals(JsonValue(is_null=True), to_json_value(rvp)) + def test_none_to(self): self.assertEquals(JsonValue(is_null=True), to_json_value(None)) http://git-wip-us.apache.org/repos/asf/beam/blob/5e62e6fd/sdks/python/apache_beam/utils/pipeline_options_test.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/utils/pipeline_options_test.py b/sdks/python/apache_beam/utils/pipeline_options_test.py index df9b2e3..284736a 100644 --- a/sdks/python/apache_beam/utils/pipeline_options_test.py +++ b/sdks/python/apache_beam/utils/pipeline_options_test.py @@ -29,7 +29,7 @@ from apache_beam.utils.value_provider import RuntimeValueProvider class PipelineOptionsTest(unittest.TestCase): - def setUp(self): + def tearDown(self): # Clean up the global variable used by RuntimeValueProvider RuntimeValueProvider.runtime_options = None
