How to use the pywaffle.waffle.array_resize function in pywaffle

To help you get started, we’ve selected a few pywaffle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gyli / PyWaffle / tests / test_utilities.py View on Github external
def test_array_resize(self):
        self.assertEqual(array_resize(array=[1, 2, 3, 4, 5], length=2), [1, 2])
        self.assertEqual(array_resize(array=[1, 2, 3, 4, 5], length=2, array_len=5), [1, 2])
        self.assertEqual(array_resize(array=[1, 2], length=5, array_len=2), [1, 2, 1, 2, 1])
        # when a tuple is passed
        self.assertEqual(array_resize(array=(1, 2), length=5, array_len=2), (1, 2, 1, 2, 1))
github gyli / PyWaffle / tests / test_utilities.py View on Github external
def test_array_resize(self):
        self.assertEqual(array_resize(array=[1, 2, 3, 4, 5], length=2), [1, 2])
        self.assertEqual(array_resize(array=[1, 2, 3, 4, 5], length=2, array_len=5), [1, 2])
        self.assertEqual(array_resize(array=[1, 2], length=5, array_len=2), [1, 2, 1, 2, 1])
        # when a tuple is passed
        self.assertEqual(array_resize(array=(1, 2), length=5, array_len=2), (1, 2, 1, 2, 1))