# Copyright 2018, Google, Inc.
# Licensed 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 os

from beta_snippets import (
    transcribe_file_with_auto_punctuation,
    transcribe_file_with_diarization,
    transcribe_file_with_enhanced_model,
    transcribe_file_with_metadata,
    transcribe_file_with_multichannel,
    transcribe_file_with_multilanguage,
    transcribe_file_with_word_level_confidence)

RESOURCES = os.path.join(os.path.dirname(__file__), 'resources')


def test_transcribe_file_with_enhanced_model(capsys):
    transcribe_file_with_enhanced_model()
    out, _ = capsys.readouterr()

    assert 'Chrome' in out


def test_transcribe_file_with_metadata(capsys):
    transcribe_file_with_metadata()
    out, _ = capsys.readouterr()

    assert 'Chrome' in out


def test_transcribe_file_with_auto_punctuation(capsys):
    transcribe_file_with_auto_punctuation()
    out, _ = capsys.readouterr()

    assert 'Okay. Sure.' in out


def test_transcribe_diarization(capsys):
    transcribe_file_with_diarization()
    out, err = capsys.readouterr()

    assert "word: 'here', speaker_tag: 1" in out


def test_transcribe_multichannel_file(capsys):
    transcribe_file_with_multichannel()
    out, err = capsys.readouterr()

    assert 'OK Google stream stranger things from Netflix to my TV' in out


def test_transcribe_multilanguage_file(capsys):
    transcribe_file_with_multilanguage()
    out, err = capsys.readouterr()

    assert 'how are you doing estoy bien e tu' in out


def test_transcribe_word_level_confidence(capsys):
    transcribe_file_with_word_level_confidence()
    out, err = capsys.readouterr()

    assert 'OK Google stream stranger things from Netflix to my TV' in out

# Copyright 2018, Google, Inc.
# Licensed 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 os

from beta_snippets import (
    transcribe_file_with_auto_punctuation,
    transcribe_file_with_diarization,
    transcribe_file_with_enhanced_model,
    transcribe_file_with_metadata,
    transcribe_file_with_multichannel,
    transcribe_file_with_multilanguage,
    transcribe_file_with_word_level_confidence)

RESOURCES = os.path.join(os.path.dirname(__file__), 'resources')


def test_transcribe_file_with_enhanced_model(capsys):
    transcribe_file_with_enhanced_model()
    out, _ = capsys.readouterr()

    assert 'Chrome' in out


def test_transcribe_file_with_metadata(capsys):
    transcribe_file_with_metadata()
    out, _ = capsys.readouterr()

    assert 'Chrome' in out


def test_transcribe_file_with_auto_punctuation(capsys):
    transcribe_file_with_auto_punctuation()
    out, _ = capsys.readouterr()

    assert 'Okay. Sure.' in out


def test_transcribe_diarization(capsys):
    transcribe_file_with_diarization()
    out, err = capsys.readouterr()

    assert "word:" in out
    assert "speaker_tag:" in out


def test_transcribe_multichannel_file(capsys):
    transcribe_file_with_multichannel()
    out, err = capsys.readouterr()

    assert 'OK Google stream stranger things from Netflix to my TV' in out


def test_transcribe_multilanguage_file(capsys):
    transcribe_file_with_multilanguage()
    out, err = capsys.readouterr()

    assert 'how are you doing estoy bien e tu' in out


def test_transcribe_word_level_confidence(capsys):
    transcribe_file_with_word_level_confidence()
    out, err = capsys.readouterr()

    assert 'OK Google stream stranger things from Netflix to my TV' in out

Test form of result only, not contents [(#1866)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1866)