示例#1
0
def test__get_example(mock_get_name, mock_get_sdk):
  mock_get_name.return_value = "filepath"
  mock_get_sdk.return_value = SDK_UNSPECIFIED

  result = _get_example(
      "/root/filepath.extension",
      "filepath.extension",
      {
          "name": "Name",
          "description": "Description",
          "multifile": "False",
          "categories": [""],
          "pipeline_options": "--option option"
      })

  assert result == Example(
      "filepath",
      "",
      SDK_UNSPECIFIED,
      "/root/filepath.extension",
      "data",
      "",
      STATUS_UNSPECIFIED,
      Tag("Name", "Description", "False", [""], "--option option"))
  mock_get_name.assert_called_once_with("filepath.extension")
  mock_get_sdk.assert_called_once_with("filepath.extension")
示例#2
0
def test__get_example(mock_get_name):
    mock_get_name.return_value = "filepath"

    result = _get_example(
        "/root/filepath.java", "filepath.java", {
            "name": "Name",
            "description": "Description",
            "multifile": "False",
            "categories": [""],
            "pipeline_options": "--option option"
        })

    assert result == Example(name="filepath",
                             sdk=SDK_JAVA,
                             filepath="/root/filepath.java",
                             code="data",
                             status=STATUS_UNSPECIFIED,
                             tag=Tag("Name", "Description", "False", [""],
                                     "--option option"))
    mock_get_name.assert_called_once_with("filepath.java")
示例#3
0
def test__get_example(mock_get_name):
    mock_get_name.return_value = "filepath"
    tag = ExampleTag(
        {
            "name": "Name",
            "description": "Description",
            "multifile": "False",
            "categories": [""],
            "pipeline_options": "--option option"
        }, "")

    result = _get_example("/root/filepath.java", "filepath.java", tag)

    assert result == Example(
        name="filepath",
        sdk=SDK_JAVA,
        filepath="/root/filepath.java",
        code="data",
        status=STATUS_UNSPECIFIED,
        tag=Tag("Name", "Description", "False", [""], "--option option"),
        link="https://github.com/apache/beam/blob/master/root/filepath.java")
    mock_get_name.assert_called_once_with("filepath.java")