From 7e8e54e84c63171e748bbf09516fd517e6821ace Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Sat, 20 Mar 2021 18:09:06 +0100 Subject: Inital commit for refactoring to lightning --- .../tests/test_character_predictor.py | 31 ---------------------- 1 file changed, 31 deletions(-) delete mode 100644 src/text_recognizer/tests/test_character_predictor.py (limited to 'src/text_recognizer/tests/test_character_predictor.py') diff --git a/src/text_recognizer/tests/test_character_predictor.py b/src/text_recognizer/tests/test_character_predictor.py deleted file mode 100644 index 01bda78..0000000 --- a/src/text_recognizer/tests/test_character_predictor.py +++ /dev/null @@ -1,31 +0,0 @@ -"""Test for CharacterPredictor class.""" -import importlib -import os -from pathlib import Path -import unittest - -from loguru import logger - -from text_recognizer.character_predictor import CharacterPredictor -from text_recognizer.networks import MLP - -SUPPORT_DIRNAME = Path(__file__).parents[0].resolve() / "support" / "emnist" - -os.environ["CUDA_VISIBLE_DEVICES"] = "" - - -class TestCharacterPredictor(unittest.TestCase): - """Tests for the CharacterPredictor class.""" - - def test_filename(self) -> None: - """Test that CharacterPredictor correctly predicts on a single image, for serveral test images.""" - network_fn_ = MLP - predictor = CharacterPredictor(network_fn=network_fn_) - - for filename in SUPPORT_DIRNAME.glob("*.png"): - pred, conf = predictor.predict(str(filename)) - logger.info( - f"Prediction: {pred} at confidence: {conf} for image with character {filename.stem}" - ) - self.assertEqual(pred, filename.stem) - self.assertGreater(conf, 0.7) -- cgit v1.2.3-70-g09d2