Added tests for yaml and json parser
# What does this PR do?

Fixes #19116


## Before submitting
- [x]  adding as parse_yaml_file method to HfArgumentParser with the code above
- [x] refactor the dupe code between parse_json_file and parse_dict similar to the code above
- [x] add a small test of parse_yaml_file
- [x]  add a small test of parse_json_file


## Who can review?

@sgugger 




_The documentation is not available anymore as the PR was closed or merged._<|||||>Where can one find examples of yaml or json configs ?