Exemplo n.º 1
0
    def test_append(self):
        """Test the append function."""
        la = LongArray(0)
        la.append(1)
        la.append(2)
        la.append(3)

        self.assertEqual(la.length, 3)
        self.assertEqual(la[0], 1)
        self.assertEqual(la[1], 2)
        self.assertEqual(la[2], 3)
Exemplo n.º 2
0
    def test_squeeze(self):
        """Tests the squeeze function."""
        la = LongArray(5)
        la.append(4)

        self.assertEqual(la.alloc > la.length, True)

        la.squeeze()

        self.assertEqual(la.length, 6)
        self.assertEqual(la.alloc == la.length, True)
        self.assertEqual(len(la.get_npy_array()), 6)