Karpman-Consulting / eQUEST-229RPDGenerator

Provide an interface for users to select eQUEST/DOE2 files, enter additional compliance details, and create and pre-validate RPD json files for use with the ASHRAE Standard 229 Ruleset Checking Tool (RCT).
Other
3 stars 0 forks source link

add mock sample #129

Open weilixu opened 1 month ago

weilixu commented 1 month ago

Adding mock module to the test code

NOTE! The test failed for now since I do not understand the data structure coming back from DOE2. In this example, the code mocked the data returning from the function get_multiple_results. When running test, the get_multiple_results are bypassed and returning the return_value.

This can be cleaned up a bit.

The idea is unit test is not testing eQuest module, they should be assumed to be correct. The goal here is to make sure the other part of the logics are correct, for example populate_data_group.

I also suggest adding unit tests to static methods such as the ones under BaseNode class.

Exception catch may missing in places, for example, the d2_result_dll = ctypes.CDLL(d2_result_dll) raise exception when the file is not found - catching this error would be helpful for front-end.

JacksonJ-KC commented 1 month ago

Adding mock module to the test code

NOTE! The test failed for now since I do not understand the data structure coming back from DOE2. In this example, the code mocked the data returning from the function get_multiple_results. When running test, the get_multiple_results are bypassed and returning the return_value.

This can be cleaned up a bit.

The idea is unit test is not testing eQuest module, they should be assumed to be correct. The goal here is to make sure the other part of the logics are correct, for example populate_data_group.

I also suggest adding unit tests to static methods such as the ones under BaseNode class.

Exception catch may missing in places, for example, the d2_result_dll = ctypes.CDLL(d2_result_dll) raise exception when the file is not found - catching this error would be helpful for front-end.

Thanks Weili! The plan was to have file validation be handled here: https://github.com/Karpman-Consulting/eQUEST-229RPDGenerator/blob/development/interface/main_app_window.py#L253

We are also considering the possibility of adjusting the plan to incorporate these RPD features into a new release of eQUEST, and expanding the eQUEST interface.