# Path: tests/util.py
# def load_test_asset(fname):
#     """
#     Load a test file from assets directory, returning contents as str.
#     """
#     path = os.path.dirname(os.path.realpath(__file__))
#     fname = os.path.join(path, 'assets', fname)
#     with open(fname, 'r') as f:
#         return f.read()


import pytest
import re
import yaml
import axonchisel.metrics.foundation.metricdef.metricdef as metricdef
import axonchisel.metrics.foundation.metricdef.mdefl as mdefl
from .util import load_test_asset
        assert mdef2.data_type == 'NUM_INT'
        assert mdef2.filters.count_filters() == 2
        filter2 = metricdef.Filter(field='foo', op='EQ', value=123)
        assert mdef2.filters.get_filters()[0] == filter2

    def test_reset(self):
        mdef2 = self.parser1.parse_ystr_metric(self.yaml_metric1)
        self.parser1.reset()
        self.parser1.reset(base=mdef2)
        with pytest.raises(TypeError):
            self.parser1.reset(base='Not MetricDef')

    #
    # Internal Helpers
    #


# ----------------------------------------------------------------------------


class TestMetSetParse(object):
    """
    Test MetSet parsing.
    """

    #
    # Setup / Teardown
    #

    def setup_method(self, method):

# Path: tests/util.py
# def load_test_asset(fname):
#     """
#     Load a test file from assets directory, returning contents as str.
#     """
#     path = os.path.dirname(os.path.realpath(__file__))
#     fname = os.path.join(path, 'assets', fname)
#     with open(fname, 'r') as f:
#         return f.read()


# Path: tests/test_mdefl.py
import pytest
import re
import yaml
import axonchisel.metrics.foundation.metricdef.metricdef as metricdef
import axonchisel.metrics.foundation.metricdef.mdefl as mdefl
from .util import load_test_asset

        assert mdef2.data_type == 'NUM_INT'
        assert mdef2.filters.count_filters() == 2
        filter2 = metricdef.Filter(field='foo', op='EQ', value=123)
        assert mdef2.filters.get_filters()[0] == filter2

    def test_reset(self):
        mdef2 = self.parser1.parse_ystr_metric(self.yaml_metric1)
        self.parser1.reset()
        self.parser1.reset(base=mdef2)
        with pytest.raises(TypeError):
            self.parser1.reset(base='Not MetricDef')

    #
    # Internal Helpers
    #


# ----------------------------------------------------------------------------


class TestMetSetParse(object):
    """
    Test MetSet parsing.
    """

    #
    # Setup / Teardown
    #

    def setup_method(self, method):

        self.yaml_metset1 = load_test_asset('metset1.yml')