Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added TestTrainingUtils suite to unit tests #621

Merged
merged 2 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/deci_core_unit_test_suite_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
from tests.unit_tests.bbox_formats_test import BBoxFormatsTest
from tests.unit_tests.config_inspector_test import ConfigInspectTest
from tests.unit_tests.repvgg_block_tests import TestRepVGGBlock
from tests.unit_tests.training_utils_test import TestTrainingUtils


class CoreUnitTestSuiteRunner:
Expand Down Expand Up @@ -119,6 +120,7 @@ def _add_modules_to_unit_tests_suite(self):
self.unit_tests_suite.addTest(self.test_loader.loadTestsFromModule(DetectionDatasetTest))
self.unit_tests_suite.addTest(self.test_loader.loadTestsFromModule(TestModelsONNXExport))
self.unit_tests_suite.addTest(self.test_loader.loadTestsFromModule(MaxBatchesLoopBreakTest))
self.unit_tests_suite.addTest(self.test_loader.loadTestsFromModule(TestTrainingUtils))

def _add_modules_to_end_to_end_tests_suite(self):
"""
Expand Down
18 changes: 5 additions & 13 deletions tests/unit_tests/training_utils_test.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
import unittest

from training.utils.utils import recursive_override
from super_gradients.training.utils.utils import recursive_override


class TestTrainingUtils(unittest.TestCase):
def test_recursive_override(self):
base_dict = {"a": 1, "b": 2, "c": {
"x": 10, "y": 20, "z": {
"q": "q_str", "i": "i_str"
}
}}

ext_dict = {"b": 4, "c": {
"x": 20, "z": {
"q": "q_str_new"
}
}}
base_dict = {"a": 1, "b": 2, "c": {"x": 10, "y": 20, "z": {"q": "q_str", "i": "i_str"}}}

ext_dict = {"b": 4, "c": {"x": 20, "z": {"q": "q_str_new"}}}

recursive_override(base_dict, ext_dict)

Expand All @@ -27,5 +19,5 @@ def test_recursive_override(self):
self.assertEqual(base_dict["c"]["z"]["i"], "i_str")


if __name__ == '__main__':
if __name__ == "__main__":
unittest.main()