"""Unit tests for report_tab.py."""

import os
import sys

import pandas as pd
import pytest

from mined_metric.builder.metrics_impl.pisces.utils.report_tab import ReportTab


class MockReportTab(ReportTab):
    """A minimal ReportTab to test some methods."""

    def __init__(self):
        """Initializes the base class."""
        dataframe = pd.DataFrame(
            data={"scenario": ["one", "two"], "foo": [1, 2]}
        )
        styles = []
        argus_host = ""
        super().__init__(dataframe, styles, argus_host)

    def get_key_metric_definitions(self):
        return {}

    def _get_metric_formats(self):
        return {}

    def _get_display_cols(self):
        """These should correspond to columns in the dataframe."""
        return ["scenario", "foo"]

    @property
    def type(self):
        return "Mock"


def test_unset_selected_scenarios():
    """Tests all scenarios are included when selected scenarios are not set."""
    mock_tab = MockReportTab()
    data_table_text = mock_tab.get_comparison_sub_tab().child.children[0].text
    assert all([x in data_table_text for x in ["scenario", "one", "two"]])


if __name__ == "__main__":
    args = [os.path.dirname(__file__), "--color=yes", "--verbose", "--verbose"]
    code = pytest.main(args)
    sys.exit(code)
