Fix inventory for test_dir_inventory

It came up that fixing this unit test may relate to another ticket that is open. This work allows us to uncomment this unit test by fixing how we pars variables allowing a quoted variable to contain a '#'.

This relates directly to GH-5837 and GH-5749.

Work also went into cleaning up some of the test data to clarify what was working.

Lastly work went into cleaning up formatting so that the code is easily read.