remove redundant check for nil

The previous conditional covers the cases where weights == nil, so
there is no need to check the converse.
Add tests for Covariance

There were no tests for covariance, only the example.