Kaileshwar16 commented on code in PR #870: URL: https://github.com/apache/wayang/pull/870#discussion_r4565647144
########## python/src/pywy/tests/test_load_collection.py: ########## @@ -0,0 +1,112 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import base64 +import json +from unittest.mock import patch + +import cloudpickle +import pytest + +from pywy.dataquanta import DataQuanta, WayangContext +from pywy.operators import CollectionSource, SourceUnaryOperator +from pywy.platforms.java import JavaPlugin + + [email protected]("values", [ + [1, -2, 0, -(2 ** 63), 2 ** 63 - 1], + [1.5, -0.0, 1e-300, 1e300], + ['quotes " and \\', "line\nfeed\ttab", "雪 😀", "", '${System.exit(1)}'], + [], + [True, False], + [[1, 2], [], [3, ["nested", False]]], + [1, "two", 3.5, True], +]) +def test_collection_plan(values): + context = WayangContext().register({JavaPlugin}) + data = context.load_collection(values) + assert isinstance(data, DataQuanta) + assert data.context is context + assert isinstance(data.operator, SourceUnaryOperator) + assert data.operator.inputs == 0 + assert data.operator.outputs == 1 + + with patch("pywy.core.core.requests.post") as post: Review Comment: the patch mocks requests.post so this unit test can inspect the generated JSON plan without needing a running REST server. Separate integration tests send real requests to the Wayang backend and verify the output files. I’ve added a comment explaining this and an assertion that exactly one request is submitted. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
