<commit_before>import unittest

from cupy.core import internal
from cupy import testing


class TestGetSize(unittest.TestCase):

    def test_none(self):
        self.assertEqual(internal.get_size(None), ())

    def check_collection(self, a):
        self.assertEqual(internal.get_size(a), tuple(a))

    def test_list(self):
        self.check_collection([1, 2, 3])

    def test_tuple(self):
        self.check_collection((1, 2, 3))

    def test_int(self):
        self.assertEqual(internal.get_size(1), (1,))

    def test_invalid(self):
        with self.assertRaises(ValueError):
            internal.get_size(1.0)


class TestInternalProd(unittest.TestCase):

    def test_empty(self):
        self.assertEqual(internal.prod([]), 1)

    def test_one(self):
        self.assertEqual(internal.prod([2]), 2)

    def test_two(self):
        self.assertEqual(internal.prod([2, 3]), 6)


class TestGetContiguousStrides(unittest.TestCase):

    def test_zero(self):
        self.assertEqual(internal.get_contiguous_strides((), 1), [])

    def test_one(self):
        self.assertEqual(internal.get_contiguous_strides((1,), 2), [2])

    def test_two(self):
        self.assertEqual(internal.get_contiguous_strides((1, 2), 3), [6, 3])

    def test_three(self):
        self.assertEqual(internal.get_contiguous_strides((1, 2, 3), 4),
                         [24, 12, 4])


class TestGetCContiguity(unittest.TestCase):

    def test_zero_in_shape(self):
        self.assertTrue(internal.get_c_contiguity((1, 0, 1), (1, 1, 1), 3))

    def test_normal(self):
        # TODO(unno): write test for normal case
        pass


class TestInferUnknownDimension(unittest.TestCase):
<commit_msg>Add test for prod_ssize_t<commit_after>import unittest

from cupy.core import internal
from cupy import testing


class TestProd(unittest.TestCase):

    def test_empty(self):
        self.assertEqual(internal.prod([]), 1)

    def test_one(self):
        self.assertEqual(internal.prod([2]), 2)

    def test_two(self):
        self.assertEqual(internal.prod([2, 3]), 6)


class TestProdSsizeT(unittest.TestCase):

    def test_empty(self):
        self.assertEqual(internal.prod([]), 1)

    def test_one(self):
        self.assertEqual(internal.prod([2]), 2)

    def test_two(self):
        self.assertEqual(internal.prod([2, 3]), 6)


class TestGetSize(unittest.TestCase):

    def test_none(self):
        self.assertEqual(internal.get_size(None), ())

    def check_collection(self, a):
        self.assertEqual(internal.get_size(a), tuple(a))

    def test_list(self):
        self.check_collection([1, 2, 3])

    def test_tuple(self):
        self.check_collection((1, 2, 3))

    def test_int(self):
        self.assertEqual(internal.get_size(1), (1,))

    def test_invalid(self):
        with self.assertRaises(ValueError):
            internal.get_size(1.0)


class TestGetContiguousStrides(unittest.TestCase):

    def test_zero(self):
        self.assertEqual(internal.get_contiguous_strides((), 1), [])

    def test_one(self):
        self.assertEqual(internal.get_contiguous_strides((1,), 2), [2])

    def test_two(self):
        self.assertEqual(internal.get_contiguous_strides((1, 2), 3), [6, 3])

    def test_three(self):
        self.assertEqual(internal.get_contiguous_strides((1, 2, 3), 4),
                         [24, 12, 4])


class TestGetCContiguity(unittest.TestCase):

    def test_zero_in_shape(self):
        self.assertTrue(internal.get_c_contiguity((1, 0, 1), (1, 1, 1), 3))

    def test_normal(self):
        # TODO(unno): write test for normal case
        pass


class TestInferUnknownDimension(unittest.TestCase):

{'fraction_non_alphanumeric': 0.1335710367526056, 'fraction_numerical': 0.024136039495337356, 'mean_word_length': 3.3057851239669422, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5517000', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1178, 'n_words': 224}