<commit_before>from neuroimaging.testing import *
import numpy.testing

from neuroimaging.core.reference.slices import bounding_box, \
  zslice, yslice, xslice
from neuroimaging.core.reference.grid import SamplingGrid

class test_Slice(TestCase):

    def test_bounding_box(self):
        shape = (10, 10, 10)
        grid = SamplingGrid.identity(shape)
        self.assertEqual(bounding_box(grid), [[0., 9.], [0, 9], [0, 9]])

    def test_box_slice(self):
        grid = SamplingGrid.identity((10,10,10,))
        t = zslice(5, [0, 9], [0, 9], grid.output_coords, (10,10)).affine
        numpy.testing.assert_almost_equal(t, [[ 0.  0.  5.],
                                              [ 1.  0.  0.],
                                              [ 0.  1.  0.],
                                              [ 0.  0.  1.]])
        

        t = yslice(4, [0, 9], [0, 9], grid.output_coords, (10,10)).affine
        numpy.testing.assert_almost_equal(t, [[ 1.  0.  0.],
                                              [ 0.  0.  4.],
                                              [ 0.  1.  0.],
                                              [ 0.  0.  1.]])
        
        t = xslice(3, [0, 9], [0, 9], grid.output_coords, (10,10)).affine
        numpy.testing.assert_almost_equal(t, [[ 1.  0.  0.],
                                              [ 0.  1.  0.],
                                              [ 0.  0.  3.],
                                              [ 0.  0.  1.]])
        





if __name__ == '__main__':
    run_module_suite()<commit_msg>Remove 'numpy.testing.' references in assert functions.<commit_after>from neuroimaging.testing import *

from neuroimaging.core.reference.slices import bounding_box, \
  zslice, yslice, xslice
from neuroimaging.core.reference.grid import SamplingGrid

class test_Slice(TestCase):

    def test_bounding_box(self):
        shape = (10, 10, 10)
        grid = SamplingGrid.identity(shape)
        self.assertEqual(bounding_box(grid), [[0., 9.], [0, 9], [0, 9]])

    def test_box_slice(self):
        grid = SamplingGrid.identity((10,10,10,))
        t = zslice(5, [0, 9], [0, 9], grid.output_coords, (10,10)).affine
        assert_almost_equal(t, [[ 0.  0.  5.],
                                              [ 1.  0.  0.],
                                              [ 0.  1.  0.],
                                              [ 0.  0.  1.]])
        

        t = yslice(4, [0, 9], [0, 9], grid.output_coords, (10,10)).affine
        assert_almost_equal(t, [[ 1.  0.  0.],
                                              [ 0.  0.  4.],
                                              [ 0.  1.  0.],
                                              [ 0.  0.  1.]])
        
        t = xslice(3, [0, 9], [0, 9], grid.output_coords, (10,10)).affine
        assert_almost_equal(t, [[ 1.  0.  0.],
                                              [ 0.  1.  0.],
                                              [ 0.  0.  3.],
                                              [ 0.  0.  1.]])
        





if __name__ == '__main__':
    run_module_suite()
{'fraction_non_alphanumeric': 0.13819825637713917, 'fraction_numerical': 0.05230868582499193, 'mean_word_length': 1.0516556291390728, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 42, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4932335', 'n_tokens_mistral': 1012, 'n_tokens_neox': 918, 'n_words': 210}