10
10
import stat
11
11
import tempfile
12
12
13
- from nose .tools import raises
13
+ from nose .tools import raises , assert_true , assert_false
14
14
15
15
from matplotlib import cbook
16
16
from matplotlib .testing .conversion_cache import ConversionCache , CacheError
@@ -28,22 +28,22 @@ def intmp(f):
28
28
with open (intmp ('fake.svg' ), 'w' ) as svg :
29
29
svg .write ('this pretends to be an svg file' )
30
30
31
- assert not cache .get (intmp ('fake.pdf' ), intmp ('fakepdf.png' ))
32
- assert not cache .get (intmp ('fake.svg' ), intmp ('fakesvg.png' ))
31
+ assert_false ( cache .get (intmp ('fake.pdf' ), intmp ('fakepdf.png' ) ))
32
+ assert_false ( cache .get (intmp ('fake.svg' ), intmp ('fakesvg.png' ) ))
33
33
34
34
with open (intmp ('fakepdf.png' ), 'w' ) as png :
35
35
png .write ('generated from the pdf file' )
36
36
cache .put (intmp ('fake.pdf' ), intmp ('fakepdf.png' ))
37
- assert cache .get (intmp ('fake.pdf' ), intmp ('copypdf.png' ))
37
+ assert_true ( cache .get (intmp ('fake.pdf' ), intmp ('copypdf.png' ) ))
38
38
with open (intmp ('copypdf.png' ), 'r' ) as copy :
39
- assert copy .read () == 'generated from the pdf file'
39
+ assert_true ( copy .read () == 'generated from the pdf file' )
40
40
41
41
with open (intmp ('fakesvg.png' ), 'w' ) as png :
42
42
png .write ('generated from the svg file' )
43
43
cache .put (intmp ('fake.svg' ), intmp ('fakesvg.png' ))
44
- assert cache .get (intmp ('fake.svg' ), intmp ('copysvg.png' ))
44
+ assert_true ( cache .get (intmp ('fake.svg' ), intmp ('copysvg.png' ) ))
45
45
with open (intmp ('copysvg.png' ), 'r' ) as copy :
46
- assert copy .read () == 'generated from the svg file'
46
+ assert_true ( copy .read () == 'generated from the svg file' )
47
47
finally :
48
48
shutil .rmtree (tmpdir )
49
49
@@ -62,23 +62,23 @@ def intmp(*f):
62
62
os .utime (filename , (i * 1000 , i * 1000 ))
63
63
64
64
cache .expire ()
65
- assert not os .path .exists (intmp ('cache' , 'file0.png' ))
66
- assert not os .path .exists (intmp ('cache' , 'file1.png' ))
67
- assert not os .path .exists (intmp ('cache' , 'file2.png' ))
68
- assert os .path .exists (intmp ('cache' , 'file3.png' ))
69
- assert os .path .exists (intmp ('cache' , 'file4.png' ))
65
+ assert_false ( os .path .exists (intmp ('cache' , 'file0.png' ) ))
66
+ assert_false ( os .path .exists (intmp ('cache' , 'file1.png' ) ))
67
+ assert_false ( os .path .exists (intmp ('cache' , 'file2.png' ) ))
68
+ assert_true ( os .path .exists (intmp ('cache' , 'file3.png' ) ))
69
+ assert_true ( os .path .exists (intmp ('cache' , 'file4.png' ) ))
70
70
71
71
with open (intmp ('cache' , 'onemore.png' ), 'w' ) as f :
72
72
f .write ('x' * 11 )
73
73
os .utime (intmp ('cache' , 'onemore.png' ), (5000 , 5000 ))
74
74
75
75
cache .expire ()
76
- assert not os .path .exists (intmp ('cache' , 'file0.png' ))
77
- assert not os .path .exists (intmp ('cache' , 'file1.png' ))
78
- assert not os .path .exists (intmp ('cache' , 'file2.png' ))
79
- assert not os .path .exists (intmp ('cache' , 'file3.png' ))
80
- assert not os .path .exists (intmp ('cache' , 'file4.png' ))
81
- assert not os .path .exists (intmp ('cache' , 'onemore.png' ))
76
+ assert_false ( os .path .exists (intmp ('cache' , 'file0.png' ) ))
77
+ assert_false ( os .path .exists (intmp ('cache' , 'file1.png' ) ))
78
+ assert_false ( os .path .exists (intmp ('cache' , 'file2.png' ) ))
79
+ assert_false ( os .path .exists (intmp ('cache' , 'file3.png' ) ))
80
+ assert_false ( os .path .exists (intmp ('cache' , 'file4.png' ) ))
81
+ assert_false ( os .path .exists (intmp ('cache' , 'onemore.png' ) ))
82
82
83
83
finally :
84
84
shutil .rmtree (tmpdir )
0 commit comments