-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20c080e
commit 523310d
Showing
2 changed files
with
25 additions
and
5 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from gv_ui import fileInput | ||
import os | ||
import os.path | ||
import pytest | ||
|
||
def test_find_source_path(): | ||
result_exist = fileInput.find_source_path('rhopol.cube', 'tests/data/') | ||
result_dne = fileInput.find_source_path('not-real.cube', 'tests/data/') | ||
assert result_exist == 'tests/data/rhopol.cube' | ||
assert result_dne == None | ||
|
||
def test_generate_unique_filename(): | ||
name_1 = fileInput.generate_unique_filename('rhopol.cube', 'tests/data/') | ||
assert name_1 == 'rhopol_1.cube' | ||
|
||
def test_copy_file(): | ||
result = fileInput.copy_file('tests/data/rhopol.cube', 'tests/data/copy.cube') | ||
assert result == True | ||
assert os.path.isfile('tests/data/rhopol.cube') == True | ||
|
||
os.remove('tests/data/copy.cube') | ||
|
||
result = fileInput.copy_file('tests/data/not-real.cube', 'tests/data/copy.cube') | ||
assert result == False | ||
assert os.path.isfile('tests/data/copy.cube') == False |