Example #1
0
 def test_find_dirs_files_with_exact_name(self):
     global tmp_dir
     actual_output = find.do_search(tmp_dir, None, 'a', None)
     
     theoretical_output = io.StringIO()
     print(os.path.join('/tmp', 'a'), file=theoretical_output)
     
     self.assertEqual(actual_output.getvalue(), theoretical_output.getvalue())
Example #2
0
 def test_type_works_with_name_specified(self):
     global tmp_dir
     actual_output = find.do_search(tmp_dir, None, 'a', 'd')
     
     theoretical_output = io.StringIO()
     print(os.path.join(tmp_dir, 'a'), file=theoretical_output)
     
     self.assertEqual(actual_output.getvalue(), theoretical_output.getvalue())
Example #3
0
    def test_find_dirs_files_with_exact_name(self):
        global tmp_dir
        actual_output = find.do_search(tmp_dir, None, 'a', None)

        theoretical_output = io.StringIO()
        print(os.path.join('/tmp', 'a'), file=theoretical_output)

        self.assertEqual(actual_output.getvalue(),
                         theoretical_output.getvalue())
Example #4
0
    def test_type_works_with_name_specified(self):
        global tmp_dir
        actual_output = find.do_search(tmp_dir, None, 'a', 'd')

        theoretical_output = io.StringIO()
        print(os.path.join(tmp_dir, 'a'), file=theoretical_output)

        self.assertEqual(actual_output.getvalue(),
                         theoretical_output.getvalue())
Example #5
0
 def test_find_dirs_files_with_regex(self):
     global tmp_dir
     actual_output = find.do_search(tmp_dir, '1', None, None)
     
     theoretical_output = io.StringIO()
     print(os.path.join(tmp_dir, 'abc123.txt'), file=theoretical_output)
     print(os.path.join(os.path.join(tmp_dir, 'a'), '1.txt'), file=theoretical_output)
     
     self.assertEqual(actual_output.getvalue(), theoretical_output.getvalue())
Example #6
0
 def test_find_dirs_file_with_globbing(self):
     global tmp_dir
     actual_output = find.do_search(tmp_dir, None, 'a*c*', None)
     
     theoretical_output = io.StringIO()
     print(os.path.join('/tmp', 'abc123.txt'), file=theoretical_output)
     print(os.path.join('/tmp', 'abc'), file=theoretical_output)
     
     self.assertEqual(actual_output.getvalue(), theoretical_output.getvalue())
Example #7
0
    def test_find_dirs_file_with_globbing(self):
        global tmp_dir
        actual_output = find.do_search(tmp_dir, None, 'a*c*', None)

        theoretical_output = io.StringIO()
        print(os.path.join('/tmp', 'abc123.txt'), file=theoretical_output)
        print(os.path.join('/tmp', 'abc'), file=theoretical_output)

        self.assertEqual(actual_output.getvalue(),
                         theoretical_output.getvalue())
Example #8
0
    def test_find_dirs_files_with_regex(self):
        global tmp_dir
        actual_output = find.do_search(tmp_dir, '1', None, None)

        theoretical_output = io.StringIO()
        print(os.path.join(tmp_dir, 'abc123.txt'), file=theoretical_output)
        print(os.path.join(os.path.join(tmp_dir, 'a'), '1.txt'),
              file=theoretical_output)

        self.assertEqual(actual_output.getvalue(),
                         theoretical_output.getvalue())