# Path: compliance_checker/base.py
# def get_namespaces():
# def csv_splitter(input_string):
#     def __init__(self, split_func=None):
#     def validator_func(self, input_value):
#     def validate(self, input_name, input_value):
#     def validate_type(self, input_name, input_value):
#     def validator_func(self, input_value):
#     def validator_func(self, input_value):
#     def validator_func(self, input_value):
#     def __init__(self, fpath):
#     def filepath(self):
#     def setup(self, ds):
#     def __init__(self, options=None):
#     def get_test_ctx(self, severity, name, variable=None):
#     def __del__(self):
#     def std_check_in(cls, dataset, name, allowed_vals):
#     def std_check(cls, dataset, name):
#     def __init__(
#         self,
#         weight=BaseCheck.MEDIUM,
#         value=None,
#         name=None,
#         msgs=None,
#         children=None,
#         checker=None,
#         check_method=None,
#         variable_name=None,
#     ):
#     def __repr__(self):
#     def serialize(self):
#     def __eq__(self, other):
#     def __init__(
#         self,
#         category=None,
#         description="",
#         out_of=0,
#         score=0,
#         messages=None,
#         variable=None,
#     ):
#     def to_result(self):
#     def assert_true(self, test, message):
#     def add_failure(self, message):
#     def add_pass(self):
# def std_check_in(base_context, name, allowed_vals):
# def std_check(dataset, name):
# def xpath_check(tree, xpath):
# def maybe_get_global_attr(attr_name, ds):
# def attr_check(kvp, ds, priority, ret_val, gname=None, var_name=None):
# def check_has(priority=BaseCheck.HIGH, gname=None):
#     def _inner(func):
#         def _dec(s, ds):
# def fix_return_value(v, method_name, method=None, checker=None):
# def ratable_result(value, name, msgs, variable_name=None):
# def score_group(group_name=None):
#     def _inner(func):
#         def _dec(s, ds):
#             def dogroup(r):
# class ValidationObject(object):
# class EmailValidator(ValidationObject):
# class RegexValidator(ValidationObject):
# class UrlValidator(ValidationObject):
# class GenericFile(object):
# class BaseCheck(object):
# class BaseNCCheck(object):
# class BaseSOSGCCheck(object):
# class BaseSOSDSCheck(object):
# class Result(object):
# class TestCtx(object):
#     HIGH = 3
#     MEDIUM = 2
#     LOW = 1


import os
from unittest import TestCase
from netCDF4 import Dataset
from compliance_checker import base
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for base compliance checker class"""






class TestBase(TestCase):
    """
    Tests functionality of the base compliance checker class
    """

    def setUp(self):
        self.acdd = base.BaseCheck()
        self.ds = Dataset(filename=os.devnull, mode="w", diskless=True)

    def tearDown(self):
        self.ds.close()

    def test_attr_presence(self):
        # attribute not present, should fail
        priority = base.BaseCheck.MEDIUM
        rv1, rv2, rv3, rv4 = [], [], [], []
        attr = ("test", None)
        base.attr_check(attr, self.ds, priority, rv1)

# Path: compliance_checker/base.py
# def get_namespaces():
# def csv_splitter(input_string):
#     def __init__(self, split_func=None):
#     def validator_func(self, input_value):
#     def validate(self, input_name, input_value):
#     def validate_type(self, input_name, input_value):
#     def validator_func(self, input_value):
#     def validator_func(self, input_value):
#     def validator_func(self, input_value):
#     def __init__(self, fpath):
#     def filepath(self):
#     def setup(self, ds):
#     def __init__(self, options=None):
#     def get_test_ctx(self, severity, name, variable=None):
#     def __del__(self):
#     def std_check_in(cls, dataset, name, allowed_vals):
#     def std_check(cls, dataset, name):
#     def __init__(
#         self,
#         weight=BaseCheck.MEDIUM,
#         value=None,
#         name=None,
#         msgs=None,
#         children=None,
#         checker=None,
#         check_method=None,
#         variable_name=None,
#     ):
#     def __repr__(self):
#     def serialize(self):
#     def __eq__(self, other):
#     def __init__(
#         self,
#         category=None,
#         description="",
#         out_of=0,
#         score=0,
#         messages=None,
#         variable=None,
#     ):
#     def to_result(self):
#     def assert_true(self, test, message):
#     def add_failure(self, message):
#     def add_pass(self):
# def std_check_in(base_context, name, allowed_vals):
# def std_check(dataset, name):
# def xpath_check(tree, xpath):
# def maybe_get_global_attr(attr_name, ds):
# def attr_check(kvp, ds, priority, ret_val, gname=None, var_name=None):
# def check_has(priority=BaseCheck.HIGH, gname=None):
#     def _inner(func):
#         def _dec(s, ds):
# def fix_return_value(v, method_name, method=None, checker=None):
# def ratable_result(value, name, msgs, variable_name=None):
# def score_group(group_name=None):
#     def _inner(func):
#         def _dec(s, ds):
#             def dogroup(r):
# class ValidationObject(object):
# class EmailValidator(ValidationObject):
# class RegexValidator(ValidationObject):
# class UrlValidator(ValidationObject):
# class GenericFile(object):
# class BaseCheck(object):
# class BaseNCCheck(object):
# class BaseSOSGCCheck(object):
# class BaseSOSDSCheck(object):
# class Result(object):
# class TestCtx(object):
#     HIGH = 3
#     MEDIUM = 2
#     LOW = 1


# Path: compliance_checker/tests/test_base.py
import os
from unittest import TestCase
from netCDF4 import Dataset
from compliance_checker import base

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for base compliance checker class"""






class TestBase(TestCase):
    """
    Tests functionality of the base compliance checker class
    """

    def setUp(self):
        self.acdd = base.BaseCheck()
        self.ds = Dataset(filename=os.devnull, mode="w", diskless=True)

    def tearDown(self):
        self.ds.close()

    def test_attr_presence(self):
        # attribute not present, should fail
        priority = base.BaseCheck.MEDIUM
        rv1, rv2, rv3, rv4 = [], [], [], []
        attr = ("test", None)
        base.attr_check(attr, self.ds, priority, rv1)

        assert rv1[0] == base.Result(priority, False, "test", ["test not present"])