Skip to content
This repository was archived by the owner on Feb 17, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions biggus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def ndarrays(arrays):
"""
return [array.ndarray() for array in arrays]

__hash__ = None

def __repr__(self):
return '<{} shape={} dtype={!r}>'.format(type(self).__name__,
self.shape, self.dtype)
Expand Down
17 changes: 17 additions & 0 deletions biggus/tests/unit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# (C) British Crown Copyright 2014, Met Office
#
# This file is part of Biggus.
#
# Biggus is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Biggus is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Biggus. If not, see <http://www.gnu.org/licenses/>.
"""Unit tests for biggus."""
50 changes: 50 additions & 0 deletions biggus/tests/unit/test_Array.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# (C) British Crown Copyright 2014, Met Office
#
# This file is part of Biggus.
#
# Biggus is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Biggus is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Biggus. If not, see <http://www.gnu.org/licenses/>.
"""Unit tests for `biggus.Array`."""

import unittest

from biggus import Array


class Test___hash__(unittest.TestCase):
def test_unhashable(self):
class FakeArray(Array):
@property
def dtype(self):
pass

@property
def shape(self):
pass

def __getitem__(self, keys):
pass

def ndarray(self, keys):
pass

def masked_array(self, keys):
pass

array = FakeArray()
with self.assertRaises(TypeError):
hash(array)


if __name__ == '__main__':
unittest.main()