コード例 #1
0
ファイル: test_find.py プロジェクト: bd4/PythonExercises
 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())
コード例 #2
0
ファイル: test_find.py プロジェクト: bd4/PythonExercises
 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())
コード例 #3
0
ファイル: test_find.py プロジェクト: bd4/PythonExercises
    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())
コード例 #4
0
ファイル: test_find.py プロジェクト: bd4/PythonExercises
    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())
コード例 #5
0
ファイル: test_find.py プロジェクト: bd4/PythonExercises
 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())
コード例 #6
0
ファイル: test_find.py プロジェクト: bd4/PythonExercises
 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())
コード例 #7
0
ファイル: test_find.py プロジェクト: bd4/PythonExercises
    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())
コード例 #8
0
ファイル: test_find.py プロジェクト: bd4/PythonExercises
    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())