def test_combines_parsed_expressions_to_and_expression(self): tags = TagExpression() tags.parse_and_add('@tag_0') tags.and_node |should| be_instance_of(AndNode) child_nodes = tags.and_node.child_nodes len(child_nodes) |should| be(1) child_nodes[0] |should| be_instance_of(TagNode) child_nodes[0].name |should| be_equal_to('tag_0')
def test_combines_parsed_expressions_to_and_expression(self): tags = TagExpression() tags.parse_and_add('@tag_0') tags.and_node | should | be_instance_of(AndNode) child_nodes = tags.and_node.child_nodes len(child_nodes) | should | be(1) child_nodes[0] | should | be_instance_of(TagNode) child_nodes[0].name | should | be_equal_to('tag_0')
def test_excludes_by_test_method_decorator(self): class Test(unittest.TestCase): @tag('include') def test_method(self): pass suite = unittest.TestSuite([Test('test_method')]) tags = TagExpression('~@include') filtered = tags.filter_suite(suite) map(str, filtered) |should| each_be_equal_to([])
def test_excludes_by_test_method_decorator(self): class Test(unittest.TestCase): @tag('include') def test_method(self): pass suite = unittest.TestSuite([Test('test_method')]) tags = TagExpression('~@include') filtered = tags.filter_suite(suite) map(str, filtered) | should | each_be_equal_to([])
def test_includes_by_test_case_decorator(self): @tag('include') class Test(unittest.TestCase): def test_method(self): pass suite = unittest.TestSuite([Test('test_method')]) tags = TagExpression('@include') filtered = tags.filter_suite(suite) map(str, filtered) |should| each_be_equal_to([ 'test_method (vows.test_tags.Test)', ])
def test_includes_by_test_case_decorator(self): @tag('include') class Test(unittest.TestCase): def test_method(self): pass suite = unittest.TestSuite([Test('test_method')]) tags = TagExpression('@include') filtered = tags.filter_suite(suite) map(str, filtered) | should | each_be_equal_to([ 'test_method (vows.test_tags.Test)', ])
def test_parses_comma_separated_group_as_or_expression(self): tags = TagExpression() node = tags.parse('@tag_1,~@tag_2,@tag_3') node |should| be_instance_of(OrNode) node_1, node_2, node_3 = node.child_nodes node_1 |should| be_instance_of(TagNode) node_1.name |should| be_equal_to('tag_1') node_2 |should| be_instance_of(NegationNode) node_2.child |should| be_instance_of(TagNode) node_2.child.name |should| be_equal_to('tag_2') node_3 |should| be_instance_of(TagNode) node_3.name |should| be_equal_to('tag_3')
def test_parses_comma_separated_group_as_or_expression(self): tags = TagExpression() node = tags.parse('@tag_1,~@tag_2,@tag_3') node | should | be_instance_of(OrNode) node_1, node_2, node_3 = node.child_nodes node_1 | should | be_instance_of(TagNode) node_1.name | should | be_equal_to('tag_1') node_2 | should | be_instance_of(NegationNode) node_2.child | should | be_instance_of(TagNode) node_2.child.name | should | be_equal_to('tag_2') node_3 | should | be_instance_of(TagNode) node_3.name | should | be_equal_to('tag_3')
def test_parses_negated_tag(self): tags = TagExpression() node = tags.parse('~@tag_name') node |should| be_instance_of(NegationNode) node.child |should| be_instance_of(TagNode) node.child.name |should| be_equal_to('tag_name')
def test_parses_tag(self): tags = TagExpression() node = tags.parse('@tag_name') node |should| be_instance_of(TagNode) node.name |should| be_equal_to('tag_name')
def test_always_matches_when_empty(self): tags = TagExpression() result = tags.match(()) result |should| be(True)
def runTest(self): tags = TagExpression() for group in groups: tags.parse_and_add(group) tags.match(test_in) |should| be(test_result)
def test_parses_negated_tag(self): tags = TagExpression() node = tags.parse('~@tag_name') node | should | be_instance_of(NegationNode) node.child | should | be_instance_of(TagNode) node.child.name | should | be_equal_to('tag_name')
def test_parses_tag(self): tags = TagExpression() node = tags.parse('@tag_name') node | should | be_instance_of(TagNode) node.name | should | be_equal_to('tag_name')
def test_always_matches_when_empty(self): tags = TagExpression() result = tags.match(()) result | should | be(True)
def runTest(self): tags = TagExpression() for group in groups: tags.parse_and_add(group) tags.match(test_in) | should | be(test_result)