1
1
import unittest
2
+ from .util import get_data
2
3
from cwltest import CompareFail
3
4
from cwltest .utils import compare_file , compare
4
5
5
6
6
- class TestCompare (unittest .TestCase ):
7
-
8
- def compare_success (self , expected , actual ):
9
- try :
10
- compare (expected , actual )
11
- except CompareFail :
12
- self .fail ("Comparison failed unexpectedly" )
13
-
14
-
15
- class TestCompareFile (TestCompare ):
7
+ class TestCompareFile (unittest .TestCase ):
16
8
17
9
def test_compare_file (self ):
18
10
expected = {
19
11
"location" : "cores.txt" ,
20
12
"size" : 2 ,
21
13
"class" : "File" ,
22
14
"checksum" : "sha1$7448d8798a4380162d4b56f9b452e2f6f9e24e7a"
23
- }
15
+ }
24
16
25
17
actual = {
26
18
"basename" : "cores.txt" ,
@@ -48,10 +40,10 @@ def test_compare_contents_success(self):
48
40
"checksum" : "sha1$7448d8798a4380162d4b56f9b452e2f6f9e24e7a" ,
49
41
"class" : "File" ,
50
42
"location" : "file:///var/folders/8x/2df05_7j20j6r8y81w4qf43r0000gn/T/tmpG0EkrS/cores.txt" ,
51
- "path" : "tests/test-data/cores.txt" ,
43
+ "path" : get_data ( "tests/test-data/cores.txt" ) ,
52
44
"size" : 2
53
45
}
54
- self . compare_success (expected , actual )
46
+ compare (expected , actual )
55
47
56
48
def test_compare_contents_failure (self ):
57
49
expected = {
@@ -66,7 +58,7 @@ def test_compare_contents_failure(self):
66
58
"checksum" : "sha1$7448d8798a4380162d4b56f9b452e2f6f9e24e7a" ,
67
59
"class" : "File" ,
68
60
"location" : "file:///var/folders/8x/2df05_7j20j6r8y81w4qf43r0000gn/T/tmpG0EkrS/cores.txt" ,
69
- "path" : "tests/test-data/cores.txt" ,
61
+ "path" : get_data ( "tests/test-data/cores.txt" ) ,
70
62
"size" : 2
71
63
}
72
64
with self .assertRaises (CompareFail ):
0 commit comments