예제 #1
0
class TestTagExpressionFooOrBarAndNotZap(object):
    def setUp(self):
        self.e = TagExpression(['foo,bar', '-zap'])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_not_match_foo_zap(self):
        assert not self.e.check(['foo', 'zap'])
예제 #2
0
class TestTagExpressionNotFoo(object):
    def setUp(self):
        self.e = TagExpression(['-foo'])

    def test_should_match_bar(self):
        assert self.e.check(['bar'])

    def test_should_not_match_foo(self):
        assert not self.e.check(['foo'])
예제 #3
0
class TestTagExpressionNoTags(object):
    def setUp(self):
        self.e = TagExpression([])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_match_empty_tags(self):
        assert self.e.check([])
예제 #4
0
class TestTagExpressionNotFooWithTilde(unittest.TestCase):
    def setUp(self):
        self.e = TagExpression(['~foo'])

    def test_should_match_bar(self):
        assert self.e.check(['bar'])

    def test_should_not_match_foo(self):
        assert not self.e.check(['foo'])
예제 #5
0
class TestTagExpressionFoo(unittest.TestCase):
    def setUp(self):
        self.e = TagExpression(['foo'])

    def test_should_not_match_no_tags(self):
        assert not self.e.check([])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_not_match_bar(self):
        assert not self.e.check(['bar'])
예제 #6
0
class TestTagExpressionFooOrBarAndNotZapWithTilde(unittest.TestCase):
    def setUp(self):
        self.e = TagExpression(['foo,bar', '~zap'])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_not_match_zap(self):
        assert not self.e.check(['zap'])

    def test_should_not_match_foo_zap(self):
        assert not self.e.check(['foo', 'zap'])
예제 #7
0
class TestTagExpressionNotFoo(unittest.TestCase):
    def setUp(self):
        self.e = TagExpression(['-foo'])

    def test_should_match_no_tags(self):
        assert self.e.check([])

    def test_should_not_match_foo(self):
        assert not self.e.check(['foo'])

    def test_should_match_bar(self):
        assert self.e.check(['bar'])
예제 #8
0
class TestTagExpressionFoo3OrNotBar4AndZap5(object):
    def setUp(self):
        self.e = TagExpression(['foo:3,-bar', 'zap:5'])

    def test_should_count_tags_for_positive_tags(self):
        tools.eq_(self.e.limits, {'foo': 3, 'zap': 5})

    def test_should_match_foo_zap(self):
        assert self.e.check(['foo', 'zap'])
class TestTagExpressionFoo3OrNotBar4AndZap5(unittest.TestCase):
    def setUp(self):
        self.e = TagExpression(['foo:3,-bar', 'zap:5'])

    def test_should_count_tags_for_positive_tags(self):
        assert self.e.limits == {'foo': 3, 'zap': 5}

    def test_should_match_foo_zap(self):
        assert self.e.check(['foo', 'zap'])
예제 #10
0
class TestTagExpressionFooAndBar(unittest.TestCase):
    # -- LOGIC: @foo and @bar

    def setUp(self):
        self.e = TagExpression(['foo', 'bar'])

    def test_should_not_match_no_tags(self):
        assert not self.e.check([])

    def test_should_not_match_foo(self):
        assert not self.e.check(['foo'])

    def test_should_not_match_bar(self):
        assert not self.e.check(['bar'])

    def test_should_not_match_other(self):
        assert not self.e.check(['other'])

    def test_should_match_foo_bar(self):
        assert self.e.check(['foo', 'bar'])
        assert self.e.check(['bar', 'foo'])

    def test_should_not_match_foo_other(self):
        assert not self.e.check(['foo', 'other'])
        assert not self.e.check(['other', 'foo'])

    def test_should_not_match_bar_other(self):
        assert not self.e.check(['bar', 'other'])
        assert not self.e.check(['other', 'bar'])

    def test_should_not_match_zap_other(self):
        assert not self.e.check(['zap', 'other'])
        assert not self.e.check(['other', 'zap'])

    def test_should_match_foo_bar_other(self):
        assert self.e.check(['foo', 'bar', 'other'])
        assert self.e.check(['bar', 'other', 'foo'])
        assert self.e.check(['other', 'bar', 'foo'])

    def test_should_not_match_foo_zap_other(self):
        assert not self.e.check(['foo', 'zap', 'other'])
        assert not self.e.check(['other', 'zap', 'foo'])

    def test_should_not_match_bar_zap_other(self):
        assert not self.e.check(['bar', 'zap', 'other'])
        assert not self.e.check(['other', 'bar', 'zap'])

    def test_should_not_match_zap_baz_other(self):
        assert not self.e.check(['zap', 'baz', 'other'])
        assert not self.e.check(['baz', 'other', 'baz'])
        assert not self.e.check(['other', 'baz', 'zap'])
예제 #11
0
class TestTagExpressionFooOrBarAndNotZap(unittest.TestCase):
    def setUp(self):
        self.e = TagExpression(['foo,bar', '-zap'])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_not_match_foo_zap(self):
        assert not self.e.check(['foo', 'zap'])

    def test_should_not_match_tags(self):
        assert not self.e.check([])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_match_bar(self):
        assert self.e.check(['bar'])

    def test_should_not_match_other(self):
        assert not self.e.check(['other'])

    def test_should_match_foo_bar(self):
        assert self.e.check(['foo', 'bar'])
        assert self.e.check(['bar', 'foo'])

    def test_should_match_foo_other(self):
        assert self.e.check(['foo', 'other'])
        assert self.e.check(['other', 'foo'])

    def test_should_match_bar_other(self):
        assert self.e.check(['bar', 'other'])
        assert self.e.check(['other', 'bar'])

    def test_should_not_match_zap_other(self):
        assert not self.e.check(['zap', 'other'])
        assert not self.e.check(['other', 'zap'])

    def test_should_match_foo_bar_other(self):
        assert self.e.check(['foo', 'bar', 'other'])
        assert self.e.check(['bar', 'other', 'foo'])
        assert self.e.check(['other', 'bar', 'foo'])

    def test_should_not_match_foo_bar_zap(self):
        assert not self.e.check(['foo', 'bar', 'zap'])
        assert not self.e.check(['bar', 'zap', 'foo'])
        assert not self.e.check(['zap', 'bar', 'foo'])

    def test_should_not_match_foo_zap_other(self):
        assert not self.e.check(['foo', 'zap', 'other'])
        assert not self.e.check(['other', 'zap', 'foo'])

    def test_should_not_match_bar_zap_other(self):
        assert not self.e.check(['bar', 'zap', 'other'])
        assert not self.e.check(['other', 'bar', 'zap'])

    def test_should_not_match_zap_baz_other(self):
        assert not self.e.check(['zap', 'baz', 'other'])
        assert not self.e.check(['baz', 'other', 'baz'])
        assert not self.e.check(['other', 'baz', 'zap'])
예제 #12
0
class TestTagExpressionFooAndBar(unittest.TestCase):
    # -- LOGIC: @foo and @bar

    def setUp(self):
        self.e = TagExpression(['foo', 'bar'])

    def test_should_not_match_no_tags(self):
        assert not self.e.check([])

    def test_should_not_match_foo(self):
        assert not self.e.check(['foo'])

    def test_should_not_match_bar(self):
        assert not self.e.check(['bar'])

    def test_should_not_match_other(self):
        assert not self.e.check(['other'])

    def test_should_match_foo_bar(self):
        assert self.e.check(['foo', 'bar'])
        assert self.e.check(['bar', 'foo'])

    def test_should_not_match_foo_other(self):
        assert not self.e.check(['foo', 'other'])
        assert not self.e.check(['other', 'foo'])

    def test_should_not_match_bar_other(self):
        assert not self.e.check(['bar', 'other'])
        assert not self.e.check(['other', 'bar'])

    def test_should_not_match_zap_other(self):
        assert not self.e.check(['zap', 'other'])
        assert not self.e.check(['other', 'zap'])

    def test_should_match_foo_bar_other(self):
        assert self.e.check(['foo', 'bar', 'other'])
        assert self.e.check(['bar', 'other', 'foo'])
        assert self.e.check(['other', 'bar', 'foo'])

    def test_should_not_match_foo_zap_other(self):
        assert not self.e.check(['foo', 'zap', 'other'])
        assert not self.e.check(['other', 'zap', 'foo'])

    def test_should_not_match_bar_zap_other(self):
        assert not self.e.check(['bar', 'zap', 'other'])
        assert not self.e.check(['other', 'bar', 'zap'])

    def test_should_not_match_zap_baz_other(self):
        assert not self.e.check(['zap', 'baz', 'other'])
        assert not self.e.check(['baz', 'other', 'baz'])
        assert not self.e.check(['other', 'baz', 'zap'])
예제 #13
0
class TestTagExpressionFooOrBarAndNotZap(unittest.TestCase):
    def setUp(self):
        self.e = TagExpression(['foo,bar', '-zap'])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_not_match_foo_zap(self):
        assert not self.e.check(['foo', 'zap'])

    def test_should_not_match_tags(self):
        assert not self.e.check([])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_match_bar(self):
        assert self.e.check(['bar'])

    def test_should_not_match_other(self):
        assert not self.e.check(['other'])

    def test_should_match_foo_bar(self):
        assert self.e.check(['foo', 'bar'])
        assert self.e.check(['bar', 'foo'])

    def test_should_match_foo_other(self):
        assert self.e.check(['foo', 'other'])
        assert self.e.check(['other', 'foo'])

    def test_should_match_bar_other(self):
        assert self.e.check(['bar', 'other'])
        assert self.e.check(['other', 'bar'])

    def test_should_not_match_zap_other(self):
        assert not self.e.check(['zap', 'other'])
        assert not self.e.check(['other', 'zap'])

    def test_should_match_foo_bar_other(self):
        assert self.e.check(['foo', 'bar', 'other'])
        assert self.e.check(['bar', 'other', 'foo'])
        assert self.e.check(['other', 'bar', 'foo'])

    def test_should_not_match_foo_bar_zap(self):
        assert not self.e.check(['foo', 'bar', 'zap'])
        assert not self.e.check(['bar', 'zap', 'foo'])
        assert not self.e.check(['zap', 'bar', 'foo'])

    def test_should_not_match_foo_zap_other(self):
        assert not self.e.check(['foo', 'zap', 'other'])
        assert not self.e.check(['other', 'zap', 'foo'])

    def test_should_not_match_bar_zap_other(self):
        assert not self.e.check(['bar', 'zap', 'other'])
        assert not self.e.check(['other', 'bar', 'zap'])

    def test_should_not_match_zap_baz_other(self):
        assert not self.e.check(['zap', 'baz', 'other'])
        assert not self.e.check(['baz', 'other', 'baz'])
        assert not self.e.check(['other', 'baz', 'zap'])