pyspread.lib.test package¶
Submodules¶
pyspread.lib.test.compat module¶
The functions in this file are extracted from the project qimage2ndarray https://github.com/hmeine/qimage2ndarray that has been publisched under the BSD-3-Clause License.
Copyright (c) 2009, Hans Meine <hans_meine@gmx.net>
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
pyspread.lib.test.test_array2qimage module¶
The functions in this file are extracted from the project qimage2ndarray https://github.com/hmeine/qimage2ndarray that has been publisched under the BSD-3-Clause License.
Copyright (c) 2009, Hans Meine <hans_meine@gmx.net>
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
pyspread.lib.test.test_csv module¶
test_csv¶
Unit tests for csv.py
pyspread.lib.test.test_file_helpers module¶
Unit tests for file_helpers.py
pyspread.lib.test.test_hashing module¶
test_hashing¶
Unit tests for hashing.py
pyspread.lib.test.test_qimageview module¶
The functions in this file are extracted from the project qimage2ndarray https://github.com/hmeine/qimage2ndarray that has been publisched under the BSD-3-Clause License.
Copyright (c) 2009, Hans Meine <hans_meine@gmx.net>
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
pyspread.lib.test.test_selection module¶
test_selection¶
Unit tests for selection.py
- class pyspread.lib.test.test_selection.TestSelection[source]¶
Bases:
object
Unit tests for Selection
- param_get_absolute_access_string = [(Selection([], [], [], [], [(32, 53), (34, 56)]), (1000, 100, 3), 0, '[S[key] for key in [(32, 53, 0)] + [(34, 56, 0)] if S[key] is not None]'), (Selection([], [], [4, 5], [53], []), (1000, 100, 3), 2, '[S[key] for key in [(4, c, 2) for c in range(100)] + [(5, c, 2) for c in range(100)] + [(r, 53, 2) for r in range(1000)] if S[key] is not None]'), (Selection([(0, 0), (2, 2)], [(1, 1), (7, 5)], [], [], []), (1000, 100, 3), 0, '[S[key] for key in [(r, c, 0) for r in range(0, 2) for c in range(0, 2)] + [(r, c, 0) for r in range(2, 8) for c in range(2, 6)] if S[key] is not None]')]¶
- param_get_bottom_borders_selection = [(Selection([(0, 0)], [(2, 2)], [], [], []), 'All borders', Selection([(-1, 0)], [(2, 2)], [], [], [])), (Selection([(0, 0)], [(2, 2)], [], [], []), 'Top border', Selection([(-1, 0)], [(-1, 2)], [], [], [])), (Selection([(0, 0)], [(2, 2)], [], [], []), 'Bottom border', Selection([(2, 0)], [(2, 2)], [], [], [])), (Selection([(0, 0)], [(2, 2)], [], [], []), 'Left border', Selection([], [], [], [], [])), (Selection([(0, 0)], [(2, 2)], [], [], []), 'Right border', Selection([], [], [], [], [])), (Selection([(0, 0)], [(2, 2)], [], [], []), 'Outer borders', Selection([(-1, 0), (2, 0)], [(-1, 2), (2, 2)], [], [], [])), (Selection([(0, 0)], [(2, 2)], [], [], []), 'Inner borders', Selection([(0, 0)], [(1, 2)], [], [], [])), (Selection([(0, 0)], [(2, 2)], [], [], []), 'Top and bottom borders', Selection([(-1, 0), (2, 0)], [(-1, 2), (2, 2)], [], [], [])), (Selection([], [], [2], [], []), 'All borders', Selection([(1, 0)], [(2, 100)], [], [], [])), (Selection([], [], [2], [], []), 'WRONG', <class 'ValueError'>)]¶
- param_test_add = [(Selection([], [], [], [], [(0, 0), (34, 56)]), (4, 5), Selection([], [], [], [], [(4, 5), (38, 61)])), (Selection([], [], [], [], [(0, 0), (34, 56)]), (0, 0), Selection([], [], [], [], [(0, 0), (34, 56)])), (Selection([], [], [], [], [(0, 0), (34, 56)]), (-3, -24), Selection([], [], [], [], [(-3, -24), (31, 32)])), (Selection([(2, 5)], [(4, 6)], [1], [0], [(0, 0), (34, 56)]), (1, 0), Selection([(3, 5)], [(5, 6)], [2], [0], [(1, 0), (35, 56)]))]¶
- param_test_and = [(Selection([], [], [], [], []), Selection([], [], [], [], []), Selection([], [], [], [], [])), (Selection([], [], [], [], [(0, 0)]), Selection([], [], [], [], []), Selection([], [], [], [], [])), (Selection([], [], [], [], [(0, 0)]), Selection([], [], [], [], [(0, 0)]), Selection([], [], [], [], [(0, 0)])), (Selection([], [], [], [], [(0, 0)]), Selection([(0, 0)], [(5, 5)], [], [], []), Selection([], [], [], [], [(0, 0)])), (Selection([(0, 0)], [(1000, 200)], [], [], []), Selection([(0, 0)], [(1000, 200)], [], [], []), Selection([(0, 0)], [(1000, 200)], [], [], [])), (Selection([(0, 0)], [(1000, 200)], [], [], []), Selection([(1, 2)], [(10, 20)], [], [], []), [(1, 2), (10, 20)]), (Selection([(0, 0)], [(1000, 200)], [], [], []), Selection([], [], [2], [], []), [(2, 3), (2, 0), (2, 200)]), (Selection([(0, 0)], [(1000, 200)], [], [], []), Selection([], [], [], [5], []), [(0, 5), (1000, 5)]), (Selection([], [], [1, 3], [], []), Selection([], [], [], [], [(1, 1)]), Selection([], [], [], [], [(1, 1)])), (Selection([], [], [], [1, 2], []), Selection([], [], [], [], [(1, 1)]), Selection([], [], [], [], [(1, 1)])), (Selection([], [], [1, 3], [], []), Selection([], [], [3], [], [(1, 1)]), Selection([], [], [3], [], [(1, 1)])), (Selection([], [], [], [1, 2], []), Selection([], [], [], [1], [(1, 1)]), Selection([], [], [], [1], [])), (Selection([], [], [1, 3], [], []), Selection([(2, 0)], [(4, 2)], [], [], [(1, 1)]), Selection([(3, 0)], [(3, 2)], [], [], [(1, 1)])), (Selection([], [], [], [1, 2], []), Selection([(0, 0)], [(3, 3)], [], [], [(1, 1)]), Selection([(0, 1), (0, 2)], [(3, 1), (3, 2)], [], [], [(1, 1)]))]¶
- param_test_cell_generator = [(Selection([], [], [], [], [(32, 53), (34, 56)]), (200, 200, 1), None, {(32, 53), (34, 56)}), (Selection([], [], [], [], [(32, 53), (34, 56)]), (1, 1, 1), None, {}), (Selection([], [], [2], [], []), (20, 20, 3), None, {(2, 0), (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (2, 7), (2, 8), (2, 9), (2, 10), (2, 11), (2, 12), (2, 13), (2, 14), (2, 15), (2, 16), (2, 17), (2, 18), (2, 19)}), (Selection([], [], [2], [3], []), (4, 4, 3), None, {(0, 3), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3), (3, 3)})]¶
- param_test_contains = [(Selection([], [], [], [], [(32, 53), (34, 56)]), (32, 53), True), (Selection([], [], [], [], [(32, 53), (34, 56)]), (23, 34534534), False), (Selection([(4, 5)], [(100, 200)], [], [], []), (4, 5), True), (Selection([(4, 5)], [(100, 200)], [], [], []), (99, 199), True), (Selection([(4, 5)], [(100, 200)], [], [], []), (100, 200), True), (Selection([(4, 5)], [(100, 200)], [], [], []), (0, 0), False), (Selection([(4, 5)], [(100, 200)], [], [], []), (0, 1), False), (Selection([(4, 5)], [(100, 200)], [], [], []), (1, 0), False), (Selection([(4, 5)], [(100, 200)], [], [], []), (4, 4), False), (Selection([(4, 5)], [(100, 200)], [], [], []), (3, 5), False), (Selection([(4, 5)], [(100, 200)], [], [], []), (100, 201), False), (Selection([(4, 5)], [(100, 200)], [], [], []), (10000000000, 10000000000), False), (Selection([], [], [3], [], []), (0, 0), False), (Selection([], [], [3], [], []), (3, 0), True), (Selection([], [], [3, 5], [], []), (3, 0), True), (Selection([], [], [3, 5], [], []), (5, 0), True), (Selection([], [], [3, 5], [], []), (4, 0), False), (Selection([], [], [], [2, 234, 434], []), (234, 234), True), (Selection([], [], [], [2, 234, 434], []), (234, 0), False), (Selection([(0, 0)], [(90, 23)], [0], [0, 34], [(0, 0)]), (0, 0), True), (Selection([(None, None)], [(90, 23)], [0], [0, 34], [(0, 0)]), (0, 0), True), (Selection([(None, None)], [(90, None)], [0], [0, 34], [(0, 0)]), (0, 0), True), (Selection([(None, None)], [(None, 23)], [0], [0, 34], [(0, 0)]), (0, 0), True)]¶
- param_test_eq = [(Selection([], [], [], [], [(32, 53), (34, 56)]), Selection([], [], [], [], [(32, 53), (34, 56)]), True), (Selection([], [], [], [], [(32, 53)]), Selection([], [], [], [], [(32, 53), (34, 56)]), False), (Selection([], [], [], [], [(34, 56), (32, 53)]), Selection([], [], [], [], [(32, 53), (34, 56)]), False), (Selection([], [], [3, 5], [1, 4], [(32, 53)]), Selection([], [], [5, 3], [1, 4], [(32, 53)]), False), (Selection([], [], [3, 5], [1, 4], [(32, 2343)]), Selection([], [], [5, 3], [1, 4], [(32, 53)]), False), (Selection([(2, 3), (9, 10)], [(5, 9), (100, 34)], [], [], []), Selection([(2, 3), (9, 10)], [(5, 9), (100, 34)], [], [], []), True), (Selection([(9, 10), (2, 3)], [(100, 34), (5, 9)], [], [], []), Selection([(2, 3), (9, 10)], [(5, 9), (100, 34)], [], [], []), False)]¶
- param_test_get_bbox = [(Selection([], [], [], [], [(32, 53), (34, 56)]), ((32, 53), (34, 56))), (Selection([(4, 5)], [(100, 200)], [], [], []), ((4, 5), (100, 200))), (Selection([(0, 2), (0, 8), (0, 4)], [(60, 2), (60, 10), (60, 4)], [], [], []), ((0, 2), (60, 10))), (Selection([], [], [2], [3], []), ((None, None), (None, None))), (Selection([], [], [], [3], []), ((None, 3), (None, 3)))]¶
- param_test_get_right_borders_selection = [(Selection([(0, 0)], [(2, 2)], [], [], []), 'All borders', Selection([(0, -1)], [(2, 2)], [], [], [])), (Selection([(0, 0)], [(2, 2)], [], [], []), 'Top border', Selection([], [], [], [], [])), (Selection([(0, 0)], [(2, 2)], [], [], []), 'Bottom border', Selection([], [], [], [], [])), (Selection([(0, 0)], [(2, 2)], [], [], []), 'Left border', Selection([(0, -1)], [(2, -1)], [], [], [])), (Selection([(0, 0)], [(2, 2)], [], [], []), 'Right border', Selection([(0, 2)], [(2, 2)], [], [], [])), (Selection([(0, 0)], [(2, 2)], [], [], []), 'Outer borders', Selection([(0, 2), (0, -1)], [(2, 2), (2, -1)], [], [], [])), (Selection([(0, 0)], [(2, 2)], [], [], []), 'Inner borders', Selection([(0, 0)], [(2, 1)], [], [], [])), (Selection([(0, 0)], [(2, 2)], [], [], []), 'Top and bottom borders', Selection([], [], [], [], [])), (Selection([], [], [2], [], []), 'All borders', Selection([(2, -1)], [(2, 100)], [], [], [])), (Selection([], [], [2], [], []), 'WRONG', <class 'ValueError'>)]¶
- param_test_insert = [(Selection([], [], [2], [], []), 1, 10, 0, Selection([], [], [12], [], [])), (Selection([], [], [], [], [(234, 23)]), 20, 4, 1, Selection([], [], [], [], [(234, 27)])), (Selection([], [], [21], [33, 44], [(234, 23)]), 40, 4, 1, Selection([], [], [21], [33, 48], [(234, 23)]))]¶
- param_test_nonzero = [(Selection([], [], [], [], []), False), (Selection([], [], [], [], [32, 34]), True), (Selection([], [], [], [], [(32, 53), (34, 56)]), True), (Selection([], [], [], [3], []), True), (Selection([], [], [2], [], []), True), (Selection([(1, 43)], [(2, 354)], [], [], []), True)]¶
- param_test_shifted = [(Selection([], [], [], [], [(32, 53), (34, 56)]), 0, 0, Selection([], [], [], [], [(32, 53), (34, 56)])), (Selection([], [], [], [], [(32, 53), (34, 56)]), 1, 1, Selection([], [], [], [], [(33, 54), (35, 57)])), (Selection([], [], [], [], [(32, 53), (34, 56)]), -1, 0, Selection([], [], [], [], [(31, 53), (33, 56)])), (Selection([], [], [], [], [(32, 53), (34, 56)]), -1, -1, Selection([], [], [], [], [(31, 52), (33, 55)])), (Selection([], [], [], [], [(32, 53), (34, 56)]), -1, 1, Selection([], [], [], [], [(31, 54), (33, 57)])), (Selection([], [], [], [], [(32, 53), (34, 56)]), -100, 100, Selection([], [], [], [], [(-68, 153), (-66, 156)])), (Selection([(0, 0), (1, 1)], [(10, 10), (50, 50)], [], [], []), 1, 0, Selection([(1, 0), (2, 1)], [(11, 10), (51, 50)], [], [], [])), (Selection([], [], [1, 4, 6], [3, 4], []), 2, 1, Selection([], [], [3, 6, 8], [4, 5], []))]¶
- param_test_single_cell_selected = [(Selection([], [], [], [], [(32, 53)]), True), (Selection([], [], [], [], [(32, 53), (34, 56)]), False), (Selection([(0, 0)], [(2, 2)], [], [], []), False), (Selection([], [], [(1, 2)], [], []), False), (Selection([], [], [], [(1, 2)], []), False)]¶
- test_get_bottom_borders_selection(sel, border_choice, res)[source]¶
Unit test for get_bottom_borders_selection
pyspread.lib.test.test_string_helpers module¶
Unit tests for string_helpers.py