Rearrange _NaT to be valid python; add attributes tests
State: closed

At the moment the organization of `tslib` is not valid python: child classes are defined above parent classes.  This PR fixes that for `_NaT` and `NaTType`.

This is necessary because trying to implement more important changes in `NaTType` is leading to build errors:

```
pandas/_libs/tslib.c:103540:3: error: use of undeclared identifier '__pyx_base'; did you mean '__pyx_k_base'?
  __pyx_base.nanosecond = __pyx_t_12;
```

_Hopefully_ fixing this will fix the build error.

This also implements tests for NaT namespace/docstrings.

- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:

Comments:
Hello @jbrockmendel! Thanks for updating the PR.



Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on October 03, 2017 at 15:27 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=h1) Report
> Merging [#17756](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/97fea48945163ec27349918c14ec9bdca2335460?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/17756/graphs/tree.svg?token=eZ4WkYLtcO&src=pr&width=650&height=150)](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #17756      +/-   ##
==========================================
- Coverage   91.25%   91.23%   -0.02%     
==========================================
  Files         163      163              
  Lines       49856    49856              
==========================================
- Hits        45496    45487       -9     
- Misses       4360     4369       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.03% <ø> (ø)` | :arrow_up: |
| #single | `40.25% <ø> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.73% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=footer). Last update [97fea48...6b54e8d](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=h1) Report
> Merging [#17756](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/2ff1241fa794231b8317ebe96b66f71dce99e0c2?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/17756/graphs/tree.svg?token=eZ4WkYLtcO&src=pr&height=150&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #17756      +/-   ##
==========================================
- Coverage   91.23%   91.21%   -0.02%     
==========================================
  Files         163      163              
  Lines       49869    49869              
==========================================
- Hits        45499    45490       -9     
- Misses       4370     4379       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.01% <ø> (ø)` | :arrow_up: |
| #single | `40.24% <ø> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.73% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=footer). Last update [2ff1241...bba888d](https://codecov.io/gh/pandas-dev/pandas/pull/17756?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

what exactly does this fix? there are no current build errros
It's pre-emptive.  Note the branch name has a "2".  That's because build errors occurred in `tslibs-nattype`.  Trying to keep PRs small to be easily reviewable.
Supserseded by #17765, where the build errors are now fixed.