# Path: tests/commons.py
# class BaseTest(unittest.TestCase):
#     """Base Test Class for all sequencer"""
#     def setUp(self):
#         _logger.debug(get_header(" Start %s " % self.id(), "*", 120))
# 
# 
#     def tearDown(self):
# #        _logger.debug(get_header(" Stop %s " % self.id(), "*", 80))
#         pass


from sequencer.dgm.errors import UnknownDepError
from sequencer.dgm.model import RuleSet, Component, ALL, NONE, AllFilter, NoneFilter, ReFilter, ScriptFilter, FullType
from tests.commons import BaseTest
import tests.dgm.tools as tools
    def test_rule_match_type(self):
        rule = tools.create_rule("RS", "RN", types=["bar@cat"])
        self.assertTrue(rule.match_type(Component("foo#bar@cat")))
        self.assertFalse(rule.match_type(Component("bar#foo@cat")))

    def test_rule_match_type_multiple(self):
        rule = tools.create_rule("RS", "RN", types=["bar@cat", "baz@cat"])
        self.assertTrue(rule.match_type(Component("foo#bar@cat")))
        self.assertTrue(rule.match_type(Component("foo#baz@cat")))
        self.assertFalse(rule.match_type(Component("bar#foo@cat")))

        rule = tools.create_rule("RS", "RN", types=["bar@cat1", "baz@cat2"])
        self.assertTrue(rule.match_type(Component("foo#bar@cat1")))
        self.assertTrue(rule.match_type(Component("foo#baz@cat2")))
        self.assertFalse(rule.match_type(Component("foo#bar@cat2")))
        self.assertFalse(rule.match_type(Component("foo#baz@cat1")))

    def test_rule_match_type_starik(self):
        rule = tools.create_rule("RS", "RN", types=[ALL])
        self.assertTrue(rule.match_type(Component("foo#bar@cat")))
        self.assertTrue(rule.match_type(Component("foo#baz@cat")))
        self.assertTrue(rule.match_type(Component("bar#foo@cat")))

    def test_rule_match_type_starik_multiple(self):
        rule = tools.create_rule("RS", "RN", types=[ALL, "foo@cat"])
        self.assertTrue(rule.match_type(Component("foo#bar@cat")))
        self.assertTrue(rule.match_type(Component("foo#baz@cat")))
        self.assertTrue(rule.match_type(Component("bar#foo@cat")))



# Path: tests/commons.py
# class BaseTest(unittest.TestCase):
#     """Base Test Class for all sequencer"""
#     def setUp(self):
#         _logger.debug(get_header(" Start %s " % self.id(), "*", 120))
# 
# 
#     def tearDown(self):
# #        _logger.debug(get_header(" Stop %s " % self.id(), "*", 80))
#         pass


# Path: tests/dgm/testmodel_basic.py
from sequencer.dgm.errors import UnknownDepError
from sequencer.dgm.model import RuleSet, Component, ALL, NONE, AllFilter, NoneFilter, ReFilter, ScriptFilter, FullType
from tests.commons import BaseTest
import tests.dgm.tools as tools

    def test_rule_match_type(self):
        rule = tools.create_rule("RS", "RN", types=["bar@cat"])
        self.assertTrue(rule.match_type(Component("foo#bar@cat")))
        self.assertFalse(rule.match_type(Component("bar#foo@cat")))

    def test_rule_match_type_multiple(self):
        rule = tools.create_rule("RS", "RN", types=["bar@cat", "baz@cat"])
        self.assertTrue(rule.match_type(Component("foo#bar@cat")))
        self.assertTrue(rule.match_type(Component("foo#baz@cat")))
        self.assertFalse(rule.match_type(Component("bar#foo@cat")))

        rule = tools.create_rule("RS", "RN", types=["bar@cat1", "baz@cat2"])
        self.assertTrue(rule.match_type(Component("foo#bar@cat1")))
        self.assertTrue(rule.match_type(Component("foo#baz@cat2")))
        self.assertFalse(rule.match_type(Component("foo#bar@cat2")))
        self.assertFalse(rule.match_type(Component("foo#baz@cat1")))

    def test_rule_match_type_starik(self):
        rule = tools.create_rule("RS", "RN", types=[ALL])
        self.assertTrue(rule.match_type(Component("foo#bar@cat")))
        self.assertTrue(rule.match_type(Component("foo#baz@cat")))
        self.assertTrue(rule.match_type(Component("bar#foo@cat")))

    def test_rule_match_type_starik_multiple(self):
        rule = tools.create_rule("RS", "RN", types=[ALL, "foo@cat"])
        self.assertTrue(rule.match_type(Component("foo#bar@cat")))
        self.assertTrue(rule.match_type(Component("foo#baz@cat")))
        self.assertTrue(rule.match_type(Component("bar#foo@cat")))



class TestDGMModel_RuleError(BaseTest):