Example #1
0
def main(argv=None):
    if argv is None:
        argv = sys.argv

    options = ""
    if "-o" in argv:
        options = "-o"
        argv.remove("-o")

    finder = Finder(Parser(), FileSystem(), Matcher())

    args = " ".join(argv[1:])
    print finder.find(args, options)
Example #2
0
class matcher_tests:

    def __init__(self):
        self.sut = Matcher()

    def test_match_returns_true_if_all_words_are_found_in_contents(self):
        result = self.sut.match("Lorem ipsum dolor", ["Lorem", "ipsum"], Logical.And)

        assert_equal(True, result)

    def test_match_returns_false_if_some_words_are_not_found_in_contents(self):
        result = self.sut.match("Lorem dolor", ["Lorem", "ipsum"], Logical.And)

        assert_equal(False, result)

    def test_match_returns_true_if_some_words_are_found_in_contents(self):
        result = self.sut.match("Lorem dolor", ["Lorem", "ipsum"], Logical.Or)

        assert_equal(True, result)

    def test_match_returns_false_if_no_words_are_found_in_contents(self):
        result = self.sut.match("None at all", ["Lorem", "ipsum"], Logical.Or)

        assert_equal(False, result)
Example #3
0
 def __init__(self):
     self.sut = Matcher()
Example #4
0
 def __init__(self):
     parser = Parser()
     fileSystem = FileSystem()
     matcher = Matcher()
     self.sut = Finder(parser, fileSystem, matcher)