Add testcase: creation of Grammar objects from non-standard file objects

Verify that a Grammar can be created from file-like objects other than
Python's standard 'file' object. In this particular case: the standard
StringIO classes.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
Don't assume that every file-like object has a 'name' attribute

When creating `Grammar` instance do not assume that just because we've
received a file-like object containing the grammar definition it'll also
have a 'name' attribute. Instead *always* try to get the 'name'
attribute, falling back on failure too using "<string>" as replacement
value.

Additionally verify that not just non-file-like objects but file-like
objects' read return value as well are of string type.

Signed-off-by: Giel van Schijndel <me@mortis.eu>