# Path: metatlas/io/write_utils.py
# def make_dir_for(file_path):
# def check_existing_file(file_path, overwrite=False):
# def export_dataframe(dataframe, file_path, description, overwrite=False, **kwargs):
# def raise_on_diff(dataframe, file_path, description, **kwargs):
# def export_dataframe_die_on_diff(dataframe, file_path, description, overwrite=False, **kwargs):


import os
import pytest
import pandas
from metatlas.io import write_utils
    write_utils.raise_on_diff(dataframe, "foo/bar", "test")
    # Should not raise an error. No assert needed.


def test_raise_on_diff03(mocker):
    mocker.patch("os.path.exists", return_value=True)
    mocker.patch("filecmp.cmp", return_value=False)
    to_write = pandas.DataFrame({1: [10], 2: [99]})
    with pytest.raises(ValueError):
        write_utils.raise_on_diff(to_write, "foo/bar", "test")


def test_export_dataframe_die_on_diff01():
    dataframe = pandas.DataFrame({1: [10], 2: [20]})
    write_utils.export_dataframe_die_on_diff(dataframe, "foo/bar", "test")
    # Should not raise an error. No assert needed.


def test_export_dataframe_die_on_diff02():
    dataframe = pandas.DataFrame({1: [10], 2: [20]})
    write_utils.export_dataframe(dataframe, "foo/bar", "test")
    write_utils.export_dataframe_die_on_diff(dataframe, "foo/bar", "test")
    # Should not raise an error. No assert needed.


def test_export_dataframe_die_on_diff03():
    existing = pandas.DataFrame({1: [10], 2: [20]})
    write_utils.export_dataframe(existing, "foo/bar", "test")
    to_write = pandas.DataFrame({1: [10], 2: [99]})
    with pytest.raises(ValueError):

# Path: metatlas/io/write_utils.py
# def make_dir_for(file_path):
# def check_existing_file(file_path, overwrite=False):
# def export_dataframe(dataframe, file_path, description, overwrite=False, **kwargs):
# def raise_on_diff(dataframe, file_path, description, **kwargs):
# def export_dataframe_die_on_diff(dataframe, file_path, description, overwrite=False, **kwargs):


# Path: tests/unit/test_write_utils.py
import os
import pytest
import pandas
from metatlas.io import write_utils

    write_utils.raise_on_diff(dataframe, "foo/bar", "test")
    # Should not raise an error. No assert needed.


def test_raise_on_diff03(mocker):
    mocker.patch("os.path.exists", return_value=True)
    mocker.patch("filecmp.cmp", return_value=False)
    to_write = pandas.DataFrame({1: [10], 2: [99]})
    with pytest.raises(ValueError):
        write_utils.raise_on_diff(to_write, "foo/bar", "test")


def test_export_dataframe_die_on_diff01():
    dataframe = pandas.DataFrame({1: [10], 2: [20]})
    write_utils.export_dataframe_die_on_diff(dataframe, "foo/bar", "test")
    # Should not raise an error. No assert needed.


def test_export_dataframe_die_on_diff02():
    dataframe = pandas.DataFrame({1: [10], 2: [20]})
    write_utils.export_dataframe(dataframe, "foo/bar", "test")
    write_utils.export_dataframe_die_on_diff(dataframe, "foo/bar", "test")
    # Should not raise an error. No assert needed.


def test_export_dataframe_die_on_diff03():
    existing = pandas.DataFrame({1: [10], 2: [20]})
    write_utils.export_dataframe(existing, "foo/bar", "test")
    to_write = pandas.DataFrame({1: [10], 2: [99]})
    with pytest.raises(ValueError):

        write_utils.export_dataframe_die_on_diff(to_write, "foo/bar", "test")