File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import glob
22import os
3- import unittest
3+
4+ import pytest
45
56from blurb .blurb import Blurbs , pushd
67
78
8- class TestParserPasses ( unittest . TestCase ) :
9+ class TestParserPasses :
910 directory = "tests/pass"
1011
1112 def filename_test (self , filename ):
1213 b = Blurbs ()
1314 b .load (filename )
14- self . assertTrue ( b )
15+ assert b
1516 if os .path .exists (filename + ".res" ):
1617 with open (filename + ".res" , encoding = "utf-8" ) as file :
1718 expected = file .read ()
18- self . assertEqual ( str (b ), expected )
19+ assert str (b ) == expected
1920
2021 def test_files (self ):
2122 with pushd (self .directory ):
2223 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
2526 continue
2627 self .filename_test (filename )
2728
@@ -31,5 +32,5 @@ class TestParserFailures(TestParserPasses):
3132
3233 def filename_test (self , filename ):
3334 b = Blurbs ()
34- with self . assertRaises (Exception ):
35+ with pytest . raises (Exception ):
3536 b .load (filename )
You can’t perform that action at this time.
0 commit comments