コード例 #1
0
def test_get_logs_returns_false_with_value_error():
    err = "err"
    mock_spark_session = MagicMock()
    type(mock_spark_session).logs = PropertyMock(side_effect=ValueError(err))
    client = LivyClient(mock_spark_session)

    res, logs_r = client.get_logs()

    assert not res
    assert logs_r == err
コード例 #2
0
ファイル: test_livyclient.py プロジェクト: vidur89/sparkmagic
def test_get_logs_returns_false_with_value_error():
    err = "err"
    mock_spark_session = MagicMock()
    mock_spark_session.get_logs = MagicMock(side_effect=ValueError(err))
    client = LivyClient(mock_spark_session)

    res, logs_r = client.get_logs()

    assert not res
    assert logs_r == err
コード例 #3
0
def test_get_logs_returns_session_logs():
    logs = "hi"
    mock_spark_session = MagicMock()
    mock_spark_session.logs = logs
    client = LivyClient(mock_spark_session)

    res, logs_r = client.get_logs()

    assert res
    assert logs_r == logs
コード例 #4
0
ファイル: test_livyclient.py プロジェクト: vidur89/sparkmagic
def test_get_logs_returns_session_logs():
    logs = "hi"
    mock_spark_session = MagicMock()
    mock_spark_session.get_logs = MagicMock(return_value=logs)
    client = LivyClient(mock_spark_session)

    res, logs_r = client.get_logs()

    assert res
    assert logs_r == logs