From 951511ed62e1dff7524ddd6ea075b60c2ec4beec Mon Sep 17 00:00:00 2001 From: Nicolas Sawyer Date: Sun, 13 Oct 2024 14:04:56 -0500 Subject: [PATCH] parser unittest multi html creator (#159) --- parser_log.txt | 37 +++++++++++++++++++ .../multiple_html_files/test_1.html | 1 + .../multiple_html_files/test_2.html | 1 + .../test_files/parser_testing/test_1.html | 1 + .../test_files/parser_testing/test_2.html | 1 + src/tester/test_unittest.py | 2 +- 6 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 parser_log.txt create mode 100644 resources/test_files/parser_testing/multiple_html_files/test_1.html create mode 100644 resources/test_files/parser_testing/multiple_html_files/test_2.html create mode 100644 resources/test_files/parser_testing/test_1.html create mode 100644 resources/test_files/parser_testing/test_2.html diff --git a/parser_log.txt b/parser_log.txt new file mode 100644 index 0000000..4530a3b --- /dev/null +++ b/parser_log.txt @@ -0,0 +1,37 @@ +2024-10-13 13:51:33,631 - INFO - Logger configured +2024-10-13 13:51:33,631 - INFO - Starting parsing for hays county with case number 51652356 +2024-10-13 13:51:33,632 - INFO - get_directories function called +base_dir: c:\Users\nicol\Documents\Open Austin\ids\indigent-defense-stats + +2024-10-13 13:51:33,633 - INFO - Returning case_html_path: c:\Users\nicol\Documents\Open Austin\ids\indigent-defense-stats\data\hays\case_html +Returning case_json_path: c:\Users\nicol\Documents\Open Austin\ids\indigent-defense-stats\data\hays\case_json + +2024-10-13 13:51:33,634 - INFO - Time started: 1728845493.6341271 +2024-10-13 13:51:33,650 - INFO - get_list_of_html function called + +2024-10-13 13:51:33,651 - INFO - parse_single_file is True + +2024-10-13 13:51:33,652 - INFO - Starting for loop to parse 1 cases +2024-10-13 13:51:33,654 - INFO - test_51652356 - parsing +2024-10-13 13:51:33,852 - INFO - Module: hays +Class: ParserHays +Method: parser_hays + +2024-10-13 13:51:33,925 - INFO - Module 'hays' imported successfully. +2024-10-13 13:51:33,928 - INFO - Class 'ParserHays' retrieved successfully. +2024-10-13 13:51:33,929 - INFO - Method 'parser_hays' retrieved successfully. +2024-10-13 13:51:33,946 - INFO - Getting case metadata for hays case test_51652356 +2024-10-13 13:51:33,951 - INFO - Getting case details +2024-10-13 13:51:33,956 - INFO - Parsing defendant rows +2024-10-13 13:51:33,957 - INFO - Parsing state rows +2024-10-13 13:51:33,957 - INFO - Getting charge information +2024-10-13 13:51:33,959 - INFO - Formatting events and orders of the court +2024-10-13 13:51:33,972 - INFO - For Loop started +Getting disposition information +2024-10-13 13:51:33,976 - INFO - Row is not a disposition: ['11/07/2016', 'CANCELED', 'Punishment Hearing', '(9:00 AM) (Judicial Officer Boyer, Bruce)', "Defendant's Request"] +2024-10-13 13:51:33,978 - INFO - Row is not a disposition: ['03/23/2016', 'CANCELED', 'Arraignment', '(9:00 AM) (Judicial Officer Henry, William R)', 'Waived Arraignment'] +2024-10-13 13:51:33,978 - INFO - Row is not a disposition: ['11/04/2019', 'Amended Deferred Adjudication', '(Judicial Officer: Boyer, Bruce) Reason: Community Supervision Extended', '1. AGGRAVATED ASSAULT WITH A DEADLY WEAPON', 'CSCD', '7 Years'] +2024-10-13 13:51:33,979 - INFO - For Loop ended + +2024-10-13 13:51:33,995 - INFO - Writing JSON to: c:\Users\nicol\Documents\Open Austin\ids\indigent-defense-stats\data\hays\case_json +2024-10-13 13:51:34,000 - INFO - Parsing took 0.3662230968475342 seconds diff --git a/resources/test_files/parser_testing/multiple_html_files/test_1.html b/resources/test_files/parser_testing/multiple_html_files/test_1.html new file mode 100644 index 0000000..30d74d2 --- /dev/null +++ b/resources/test_files/parser_testing/multiple_html_files/test_1.html @@ -0,0 +1 @@ +test \ No newline at end of file diff --git a/resources/test_files/parser_testing/multiple_html_files/test_2.html b/resources/test_files/parser_testing/multiple_html_files/test_2.html new file mode 100644 index 0000000..30d74d2 --- /dev/null +++ b/resources/test_files/parser_testing/multiple_html_files/test_2.html @@ -0,0 +1 @@ +test \ No newline at end of file diff --git a/resources/test_files/parser_testing/test_1.html b/resources/test_files/parser_testing/test_1.html new file mode 100644 index 0000000..30d74d2 --- /dev/null +++ b/resources/test_files/parser_testing/test_1.html @@ -0,0 +1 @@ +test \ No newline at end of file diff --git a/resources/test_files/parser_testing/test_2.html b/resources/test_files/parser_testing/test_2.html new file mode 100644 index 0000000..30d74d2 --- /dev/null +++ b/resources/test_files/parser_testing/test_2.html @@ -0,0 +1 @@ +test \ No newline at end of file diff --git a/src/tester/test_unittest.py b/src/tester/test_unittest.py index a689ed2..48a2b90 100644 --- a/src/tester/test_unittest.py +++ b/src/tester/test_unittest.py @@ -882,7 +882,7 @@ def test_parser_list_of_single_html_file_by_casenumber(self): self.assertEqual(case_list, expected_list) self.mock_logger.info.assert_called() - @patch("os.path.join", side_effect=lambda *args: "/".join(args)) + @patch("os.path.join", side_effect=lambda *args: "\\".join(args)) def test_parser_list_of_multiple_html_files(self, mock_join): os.makedirs(self.case_html_path, exist_ok=True)