import unittest

class myTestSuite(unittest.TestCase):
    def setup(self):
        pass

    def tearDown(self):
        pass

    def getNeighbors(self, matrix, center):
	count=0
	x_steps=(-1,0,1)
	y_steps=(-1,0,1)
	for x_step in x_steps:
	    for y_step in y_steps:
		x=center[0]+x_step
		y=center[1]+y_step
		if(x<0 or y<0):
		    continue
     	        if(x>3 or y>3):
		    continue
	        if(x==center[0] and y==center[1]):
		    continue
	        if(y>=len(matrix)):
		    continue
		if(x>=len(matrix[y])):
		    continue
	        if(matrix[y][x]==1):
		    count+=1
        return count 

    def test_111x111x111_return_8(self):
	matrix=((1,1,1),(1,1,1),(1,1,1))
	center=(1,1)
        self.assertEqual(self.getNeighbors(matrix,center), 8)

    def test_000x010x000_return_0(self):
	matrix=((0,0,0),(0,1,0),(0,0,0))
	center=(1,1)
        self.assertEqual(self.getNeighbors(matrix,center), 0)

    def test_11111x11111x11111x11111x11111_return_24(self):
	matrix=((1,1,1,1,1),(1,1,1,1,1),(1,1,1,1,1),(1,1,1,1,1),(1,1,1,1,1))
	center=(2,2)
        self.assertEqual(self.getNeighbors(matrix,center), 8)

    def test_11x11_return_3(self):
	matrix=((1,1),(1,1))
	center=(0,0)
        self.assertEqual(self.getNeighbors(matrix,center), 3)

    def test_11x11_return_3(self):
	matrix=((1,1),(1,1))
	center=(0,1)
        self.assertEqual(self.getNeighbors(matrix,center), 3)

    def test_11x11_return_3_1(self):
	matrix=((1,1),(1,1))
	center=(1,0)
        self.assertEqual(self.getNeighbors(matrix,center), 3)

    def test_11x11_return_3_2(self):
	matrix=((1,1),(1,1))
	center=(1,1)
        self.assertEqual(self.getNeighbors(matrix,center), 3)

if __name__ == "__main__":
    unittest.main()

@@ -215,17 +215,17 @@
 1)%0A%09for 
-x
+y
 _step in
@@ -225,17 +225,17 @@
 step in 
-x
+y
 _steps:%0A
@@ -239,25 +239,25 @@
 s:%0A%09    for 
-y
+x
 _step in y_s
@@ -245,33 +245,33 @@
   for x_step in 
-y
+x
 _steps:%0A%09%09x=cent
@@ -273,17 +273,17 @@
 =center%5B
-0
+1
 %5D+x_step
@@ -294,17 +294,17 @@
 =center%5B
-1
+0
 %5D+y_step
@@ -404,17 +404,17 @@
 =center%5B
-0
+1
 %5D and y=
@@ -421,17 +421,17 @@
 =center%5B
-1
+0
 %5D):%0A%09%09  
@@ -1257,32 +1257,34 @@
 t_11x11_return_3
+_0
 (self):%0A%09matrix=
@@ -1575,32 +1575,32 @@
 )%0A%09center=(1,1)%0A
-
         self.ass
@@ -1646,16 +1646,298 @@
 r), 3)%0A%0A
+    def test_111x111_return_5(self):%0A%09matrix=((1,1,1),(1,1,1))%0A%09center=(0,1)%0A        self.assertEqual(self.getNeighbors(matrix,center), 5)%0A%0A    def test_111x111_return_5_1(self):%0A%09matrix=((1,1,1),(1,1,1))%0A%09center=(1,1)%0A        self.assertEqual(self.getNeighbors(matrix,center), 5)%0A%0A
 if __nam

2x3 (0,1)(1,1) return 5