Files
doczyai-pipelines/fieldExtraction/tests/calculate_progress_stats_test.py
T
Alex Galarce 3740588efa Merged in refactor/daip-2-9-code-refactor (pull request #339)
Refactor/daip2-9 code refactor

* add missing import

* refactor ac_smart_chunking.py

* update tests

* removed old and unused imports

* removed outdated import

* forgot to import re

* refactor bottom up funcs

* remove unused imports from file_processing.py

* refactor dict_operations.py

* remove unused import from conditional_funcs.py

* replace top_down_funcs with one_to_n_funcs and remove top_down_funcs.py

* remove duplicate import from one_to_n_funcs.py

* refactor all utils.py imports

* refactor error handling by removing last code in utils and integrating InvalidDateException into postprocessing_funcs

* refactor import in claude_funcs.py to use string_funcs directly and (hopefully) resolve circular import

* refactor regex_funcs.py to use postprocessing_funcs for add_hyphen_if_needed calls

* refactor hotfix_helper_funcs.py to use postprocessing_funcs for add_hyphen_if_needed calls

* refactor postprocess.py to remove unused imports

* add numpy import to string_funcs

* fix tests after utils refactor

* move adhoc from tests to scripts

* remove unused imports

* remove scripts from mypy checking

* isort

* Merged main into refactor/daip-2-9-code-refactor


Approved-by: Katon Minhas
2025-01-06 15:39:29 +00:00

27 lines
944 B
Python

import os
import sys
import unittest
from tracking import calculate_progress_stats
class TestCalculateProgressStats(unittest.TestCase):
def test_normal_case(self):
ac_progress, b_progress = calculate_progress_stats(50, 100, 25, 50)
self.assertAlmostEqual(ac_progress, 50.0)
self.assertAlmostEqual(b_progress, 50.0)
def test_zero_total(self):
ac_progress, b_progress = calculate_progress_stats(50, 0, 25, 50)
self.assertEqual(ac_progress, 0)
self.assertAlmostEqual(b_progress, 50.0)
def test_completed_exceeds_total(self):
ac_progress, b_progress = calculate_progress_stats(120, 100, 60, 50)
self.assertEqual(ac_progress, 100.0)
self.assertEqual(b_progress, 100.0)
def test_all_zeros(self):
ac_progress, b_progress = calculate_progress_stats(0, 0, 0, 0)
self.assertEqual(ac_progress, 0)
self.assertEqual(b_progress, 0)