Libdoc: Enhanced dynamic library tests
Allow setting test library documentation dynamically in __init__.

Earlier __doc__ was read from library classes, now it is read from
instances. Fixes #1859.