# Path: onecodex/exceptions.py
# class OneCodexException(Exception):
#     pass


from hashlib import sha256
from onecodex.exceptions import OneCodexException
import pytest
import warnings

    norm_results = samples.to_df(normalize=True)
    assert norm_results.ocx._guess_normalized() is True

    unnorm_results = samples.to_df(normalize=False)
    assert unnorm_results.ocx._guess_normalized() is False


def test_normalization_with_zero_abundance_samples(ocx, api_data):
    samples = ocx.Samples.where(project="4b53797444f846c4")
    samples._collate_results(metric="readcount_w_children")
    samples._results.iloc[:2, :] = 0
    assert not samples._guess_normalized()

    df = samples.to_df(normalize=True)

    assert list(df.sum(axis=1, skipna=False).round(6)) == [0.0, 0.0, 1.0]


def test_metadata_fetch(ocx, api_data):
    samples = ocx.Samples.where(project="4b53797444f846c4")

    samples._collate_results(metric="readcount_w_children")

    # tuple with invalid field
    with pytest.raises(OneCodexException) as e:
        samples._metadata_fetch([("does_not_exist", "vegetables")])
    assert "not found" in str(e.value)

    # tuple where one field is not categorical

# Path: onecodex/exceptions.py
# class OneCodexException(Exception):
#     pass


# Path: tests/test_analyses.py
from hashlib import sha256
from onecodex.exceptions import OneCodexException
import pytest
import warnings


    norm_results = samples.to_df(normalize=True)
    assert norm_results.ocx._guess_normalized() is True

    unnorm_results = samples.to_df(normalize=False)
    assert unnorm_results.ocx._guess_normalized() is False


def test_normalization_with_zero_abundance_samples(ocx, api_data):
    samples = ocx.Samples.where(project="4b53797444f846c4")
    samples._collate_results(metric="readcount_w_children")
    samples._results.iloc[:2, :] = 0
    assert not samples._guess_normalized()

    df = samples.to_df(normalize=True)

    assert list(df.sum(axis=1, skipna=False).round(6)) == [0.0, 0.0, 1.0]


def test_metadata_fetch(ocx, api_data):
    samples = ocx.Samples.where(project="4b53797444f846c4")

    samples._collate_results(metric="readcount_w_children")

    # tuple with invalid field
    with pytest.raises(OneCodexException) as e:
        samples._metadata_fetch([("does_not_exist", "vegetables")])
    assert "not found" in str(e.value)

    # tuple where one field is not categorical

    with pytest.raises(OneCodexException) as e: