Files
doczyai-pipelines/fieldExtraction/tests/calculate_progress_stats_test.py
T
Faizan Mohiuddin 9a736fa80d Merged in feature/self-repair-main (pull request #313)
Feature/self repair main

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* new testing

* new testing

* added unit tests under fieldExtraction/tests/main-unit-tests

* unit test fixes

* unit test fixes

* merge into main

* modified consolidate_output and slight changes to qa_qc_helpers to accomodate qaqc functionality w faizan and michael's changes

* merging self repair into main

* synced with main now

* fixes

* provider billing removed

* provider billing removed

* provider billing fixed

* commented out load dotenv in config

* Merged main into feature/self-repair-main

* modified check_s3_bucket_exists function by returning False if credentials not found for pipeline

* Merge branch 'feature/self-repair-main' of https://bitbucket.org/aarete/doczy.ai into feature/self-repair-main


Approved-by: Michael McGuinness
2024-12-17 16:34:59 +00:00

27 lines
941 B
Python

import os
import sys
import unittest
from utils 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)