Fix defined_names

This patch fixes a bug in `defined_names`.  It didn't work properly because `Parser.scope` is a class scope when there is only one class is defined.
```py
jedi.parsing.Parser("""
class Class:
    pass
""").scope  # => <Class: Class@2-4>
```
So, `defined_names` uses `Parser.module` instead of `Parser.scope` now: 6acf34efd3737cf72a5a44c5a49475d1a78a06c1

Probably `Parser.scope` must be a module scope always when `user_position` is `None`?  But even so, I think using `Scope.module` is the right thing to do in `defined_names`.  If `Parser.scope` must be a module scope in this case, let's track it as another issue.


Other minor changes:

- Refactor tests for `defined_names`
- Make `defined_names` importable at top-level