mirror of
https://github.com/qurator-spk/dinglehopper.git
synced 2025-07-11 11:29:57 +02:00
🐛 dinglehopper: Fix working_directory() context manager
This commit is contained in:
parent
5273d10bac
commit
f98c527c93
2 changed files with 10 additions and 10 deletions
|
@ -16,7 +16,7 @@ class working_directory:
|
||||||
os.chdir(self.wd)
|
os.chdir(self.wd)
|
||||||
|
|
||||||
def __exit__(self, etype, value, traceback):
|
def __exit__(self, etype, value, traceback):
|
||||||
os.chdir(self.wd)
|
os.chdir(self.old_wd)
|
||||||
|
|
||||||
|
|
||||||
def test_cli_json(tmp_path):
|
def test_cli_json(tmp_path):
|
||||||
|
@ -29,10 +29,10 @@ def test_cli_json(tmp_path):
|
||||||
with open('ocr.txt', 'w') as ocrf:
|
with open('ocr.txt', 'w') as ocrf:
|
||||||
ocrf.write('AAAAB')
|
ocrf.write('AAAAB')
|
||||||
|
|
||||||
process('gt.txt', 'ocr.txt', 'report')
|
process('gt.txt', 'ocr.txt', 'report')
|
||||||
with open('report.json', 'r') as jsonf:
|
with open('report.json', 'r') as jsonf:
|
||||||
j = json.load(jsonf)
|
j = json.load(jsonf)
|
||||||
assert j['cer'] == pytest.approx(0.2)
|
assert j['cer'] == pytest.approx(0.2)
|
||||||
|
|
||||||
|
|
||||||
def test_cli_json_cer_is_infinity(tmp_path):
|
def test_cli_json_cer_is_infinity(tmp_path):
|
||||||
|
@ -45,7 +45,7 @@ def test_cli_json_cer_is_infinity(tmp_path):
|
||||||
with open('ocr.txt', 'w') as ocrf:
|
with open('ocr.txt', 'w') as ocrf:
|
||||||
ocrf.write('Not important')
|
ocrf.write('Not important')
|
||||||
|
|
||||||
process('gt.txt', 'ocr.txt', 'report')
|
process('gt.txt', 'ocr.txt', 'report')
|
||||||
with open('report.json', 'r') as jsonf:
|
with open('report.json', 'r') as jsonf:
|
||||||
j = json.load(jsonf)
|
j = json.load(jsonf)
|
||||||
assert j['cer'] == pytest.approx(float('inf'))
|
assert j['cer'] == pytest.approx(float('inf'))
|
||||||
|
|
|
@ -23,7 +23,7 @@ class working_directory:
|
||||||
os.chdir(self.wd)
|
os.chdir(self.wd)
|
||||||
|
|
||||||
def __exit__(self, etype, value, traceback):
|
def __exit__(self, etype, value, traceback):
|
||||||
os.chdir(self.wd)
|
os.chdir(self.old_wd)
|
||||||
|
|
||||||
|
|
||||||
def test_ocrd_cli(tmp_path):
|
def test_ocrd_cli(tmp_path):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue