Add tests for attr function