fix 6068:Make the test class dependencies fulfill all the tests. #6079
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cause of the Issue:
The cause of the issue is that the 'type' field is removed from the dependencies_dict (using pop('type')), which causes the 'type' field to no longer exist in the dictionary during subsequent operations. When trying to assign the value of 'type' to the kind attribute through the Dependency.from_dictionary method, the dictionary no longer contains the 'type' field, which results in kind being incorrectly set to None.
Solution:
By using deepcopy(dependencies_dict), a copy of dependencies_dict is created, so any changes made to the copy (new_dependencies_dict) do not affect the original dictionary. This ensures that the 'type' field remains intact in the copied dictionary, allowing the correct assignment of kind from the 'type' field when calling Dependency.from_dictionary(d), thus avoiding the issue caused by modifying the original dictionary.