Add examples for GenericPath methods.

I wanted to use `assert_eq` throughout, but that does not seem possible (see #15625)
I believe that paths are internally normalized, so this test (and ones below) may fail on windows due to `/` being normalized to `\`. I don't think we currently run doc tests on windows, but this may surprise someone at some point.