File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 1
1
import glob
2
2
import os
3
- import unittest
3
+
4
+ import pytest
4
5
5
6
from blurb .blurb import Blurbs , pushd
6
7
7
8
8
- class TestParserPasses ( unittest . TestCase ) :
9
+ class TestParserPasses :
9
10
directory = "tests/pass"
10
11
11
12
def filename_test (self , filename ):
12
13
b = Blurbs ()
13
14
b .load (filename )
14
- self . assertTrue ( b )
15
+ assert b
15
16
if os .path .exists (filename + ".res" ):
16
17
with open (filename + ".res" , encoding = "utf-8" ) as file :
17
18
expected = file .read ()
18
- self . assertEqual ( str (b ), expected )
19
+ assert str (b ) == expected
19
20
20
21
def test_files (self ):
21
22
with pushd (self .directory ):
22
23
for filename in glob .glob ("*" ):
23
- if filename [ - 4 :] == ".res" :
24
- self . assertTrue ( os .path .exists (filename [:- 4 ]), filename )
24
+ if filename . endswith ( ".res" ) :
25
+ assert os .path .exists (filename [:- 4 ]), filename
25
26
continue
26
27
self .filename_test (filename )
27
28
@@ -31,5 +32,5 @@ class TestParserFailures(TestParserPasses):
31
32
32
33
def filename_test (self , filename ):
33
34
b = Blurbs ()
34
- with self . assertRaises (Exception ):
35
+ with pytest . raises (Exception ):
35
36
b .load (filename )
You can’t perform that action at this time.
0 commit comments