{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "8083da92", "metadata": { "ExecuteTime": { "end_time": "2022-08-09T11:44:32.340662Z", "start_time": "2022-08-09T11:44:31.757862Z" } }, "outputs": [], "source": [ "import os\n", "from unit_test import UnitTest" ] }, { "cell_type": "markdown", "id": "1f664ba2", "metadata": {}, "source": [ "### Set up paths " ] }, { "cell_type": "code", "execution_count": 2, "id": "ed49737e", "metadata": { "ExecuteTime": { "end_time": "2022-08-09T11:44:33.073519Z", "start_time": "2022-08-09T11:44:33.071997Z" } }, "outputs": [], "source": [ "easyocr_module = \"../easyocr\"\n", "verbose = 2\n", "test_data = \"./data/EasyOcrUnitTestPackage.pickle\"\n", "image_data_dir = \"../examples\"" ] }, { "cell_type": "markdown", "id": "99863c23", "metadata": {}, "source": [ "### Initialize UnitTest" ] }, { "cell_type": "code", "execution_count": 3, "id": "487955be", "metadata": { "ExecuteTime": { "end_time": "2022-08-09T11:44:38.768726Z", "start_time": "2022-08-09T11:44:34.017508Z" }, "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Unit test is set for EasyOCR at /home/rakpong/team/EasyOCR_private/easyocr\n" ] } ], "source": [ "unit_test = UnitTest(easyocr_module, \n", " test_data,\n", " image_data_dir\n", " )" ] }, { "cell_type": "markdown", "id": "8a1da79b", "metadata": {}, "source": [ "### Run the test with verbosity level 2" ] }, { "cell_type": "code", "execution_count": 4, "id": "37da586b", "metadata": { "ExecuteTime": { "end_time": "2022-08-09T11:44:47.011434Z", "start_time": "2022-08-09T11:44:40.669523Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Testing EasyOCR: 9 modules will be tested.\n", "\n", "##Testing module model initialization: 4 tests will be performed.\n", "#### test01: Counting parameters of detector module.\n", "#### Passed. [1/4]\n", "#### test02: Calculating total norm of parameters in detector module.\n", "#### Passed. [2/4]\n", "#### test03: Counting parameters of recognition module.\n", "#### Passed. [3/4]\n", "#### test04: Calculating total norm of parameters in recognition module.\n", "#### Passed. [4/4]\n", "##Module model initialization: Passed.\n", "\n", "##Testing module get_textbox function: 3 tests will be performed.\n", "#### test01: Testing with default input.\n", "#### Passed. [1/3]\n", "#### test02: Testing with custom input.\n", "#### Passed. [2/3]\n", "#### test03: Testing with custom input.\n", "#### Passed. [3/3]\n", "##Module get_textbox function: Passed.\n", "\n", "##Testing module group_text_box function: 3 tests will be performed.\n", "#### test01: Testing with default input.\n", "#### Passed. [1/3]\n", "#### test02: Testing with custom input.\n", "#### Passed. [2/3]\n", "#### test03: Testing with custom input.\n", "#### Passed. [3/3]\n", "##Module group_text_box function: Passed.\n", "\n", "##Testing module detect method: 3 tests will be performed.\n", "#### test01: Testing with default input.\n", "#### Passed. [1/3]\n", "#### test02: Testing with custom input.\n", "#### Passed. [2/3]\n", "#### test03: Testing with custom input.\n", "#### Passed. [3/3]\n", "##Module detect method: Passed.\n", "\n", "##Testing module get_image_list function: 2 tests will be performed.\n", "#### test01: Testing with default input.\n", "#### Passed. [1/2]\n", "#### test02: Testing with custom input.\n", "#### Passed. [2/2]\n", "##Module get_image_list function: Passed.\n", "\n", "##Testing module get_text_test function: 3 tests will be performed.\n", "#### test01: Testing with default input.\n", "#### Passed. [1/3]\n", "#### test02: Testing with custom input.\n", "#### Passed. [2/3]\n", "#### test03: Testing with custom input.\n", "#### Passed. [3/3]\n", "##Module get_text_test function: Passed.\n", "\n", "##Testing module get_paragraph_test function: 3 tests will be performed.\n", "#### test01: Testing with default input.\n", "#### Passed. [1/3]\n", "#### test02: Testing with custom input.\n", "#### Passed. [2/3]\n", "#### test03: Testing with custom input.\n", "#### Passed. [3/3]\n", "##Module get_paragraph_test function: Passed.\n", "\n", "##Testing module recognize method: 2 tests will be performed.\n", "#### test01: Testing with default input.\n", "#### Passed. [1/2]\n", "#### test02: Testing with custom input.\n", "#### Passed. [2/2]\n", "##Module recognize method: Passed.\n", "\n", "##Testing module readtext method: 4 tests will be performed.\n", "#### test01: Reading English text.\n", "#### Passed. [1/4]\n", "#### test02: Reading French text.\n", "#### Passed. [2/4]\n", "#### test03: Reading Chinese (simplified) text.\n", "#### Passed. [3/4]\n", "#### test04: Reading Korean text.\n", "#### Passed. [4/4]\n", "##Module readtext method: Passed.\n", "\n", "##################################################\n", "Testing completed:\n", " Final result: Passed.\n" ] } ], "source": [ "unit_test.do_test(verbose = 2)" ] }, { "cell_type": "code", "execution_count": null, "id": "b62ccbd9", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" } }, "nbformat": 4, "nbformat_minor": 5 }