Source

pygame / test / mask_test.py

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
try:
    import pygame2.test.pgunittest as unittest
except:
    import pgunittest as unittest

import random
import pygame2
import pygame2.mask
from pygame2.mask import Mask
import pygame2.sdl.video as video
import pygame2.sdl.constants as sdlconst


def random_mask(size = (100,100)):
    """random_mask(size=(100,100)): return Mask
    Create a mask of the given size, with roughly half the bits set at
    random."""
    m = Mask(size)
    for i in range(size[0] * size[1] // 2):
        x, y = random.randint(0,size[0] - 1), random.randint(0, size[1] - 1)
        m.set_at((x,y))
    return m

class MaskTest (unittest.TestCase):

    def assertMaskEquals(self, m1, m2):
        self.assertEquals(m1.size, m2.size)
        for i in range(m1.size[0]):
            for j in range(m1.size[1]):
                self.assertEquals(m1.get_at((i,j)), m2.get_at((i,j)))

    def todo_test_pygame2_mask_Mask_angle(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.angle:

        # Gets the orientation of the pixels. Finds the approximate
        # orientation of the pixels in the image from -90 to 90 degrees. This
        # works best if performed on one connected component of pixels. It
        # will return 0.0 on an empty Mask.

        self.fail() 

    def todo_test_pygame2_mask_Mask_centroid(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.centroid:

        # Gets the centroid, the center of pixel mass, of the pixels in a
        # Mask. Returns a coordinate tuple for the centroid of the Mask. if
        # the Mask is empty, it will return (0,0).

        self.fail() 

    def todo_test_pygame2_mask_Mask_clear(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.clear:

        # Mask.clear () -> None
        # 
        # Clears all bits in the Mask.
        # 
        # Resets the state of all bits in the Mask to 0..

        self.fail() 

    def todo_test_pygame2_mask_Mask_connected_component(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.connected_component:

        # Mask.connected_component (x=None, y=None) -> Mask
        # 
        # Returns a Mask of a connected region of pixels.
        # 
        # Mask.connected_component (x=None, y=None) -> Mask  Returns a Mask of
        # a connected region of pixels.  This uses the SAUF algorithm to find
        # a connected component in the Mask. It checks 8 point connectivity.
        # By default, it will return the largest connected component in the
        # image. Optionally, a coordinate pair of a pixel can be specified,
        # and the connected component containing it will be returned. In the
        # event the pixel at that location is not set, the returned Mask will
        # be empty. The Mask returned is the same size as the original Mask.

        self.fail() 

    def test_pygame2_mask_Mask_connected_components(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.connected_components:

        # Mask.connected_component (x=None, y=None) -> Mask
        # 
        # Returns a Mask of a connected region of pixels.
        # 
        # Mask.connected_component (x=None, y=None) -> Mask  Returns a Mask of
        # a connected region of pixels.  This uses the SAUF algorithm to find
        # a connected component in the Mask. It checks 8 point connectivity.
        # By default, it will return the largest connected component in the
        # image. Optionally, a coordinate pair of a pixel can be specified,
        # and the connected component containing it will be returned. In the
        # event the pixel at that location is not set, the returned Mask will
        # be empty. The Mask returned is the same size as the original Mask.
        m = Mask(10,10)
        self.assertEquals(repr(m.connected_components()), "[]")
        
        comp = m.connected_component()
        self.assertEquals(m.count, comp.count)
        
        m.set_at(0,0, 1)
        m.set_at(1,1, 1)
        comp = m.connected_component()
        comps = m.connected_components()
        comps1 = m.connected_components(1)
        comps2 = m.connected_components(2)
        comps3 = m.connected_components(3)
        self.assertEquals(comp.count, comps[0].count)
        self.assertEquals(comps1[0].count, 2)
        self.assertEquals(comps2[0].count, 2)
        self.assertEquals(repr(comps3), "[]")
        
        m.set_at(9, 9, 1)
        comp = m.connected_component()
        comp1 = m.connected_component(1, 1)
        comp2 = m.connected_component(2, 2)
        comps = m.connected_components()
        comps1 = m.connected_components(1)
        comps2 = m.connected_components(2)
        comps3 = m.connected_components(3)
        self.assertEquals(comp.count, 2)
        self.assertEquals(comp1.count, 2)
        self.assertEquals(comp2.count, 0)
        self.assertEquals(len(comps), 2)
        self.assertEquals(len(comps1), 2)
        self.assertEquals(len(comps2), 1)
        self.assertEquals(len(comps3), 0)


    def todo_test_pygame2_mask_Mask_count(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.count:

        # Gets the amount of bits in the Mask.

        self.fail() 

    def test_pygame2_mask_Mask_convolve(self):

        # __doc__ (as of 2009-05-11) for pygame2.mask.Mask.convolve:

        # Mask.convolve (mask[, outputmask, point]) -> Mask
        #
        # Return the convolution with another Mask.Returns a Mask with
        # the [x-offset[0], y-offset[1]] bitset if shifting *mask* so
        # that it's lower right corner pixel isat (x, y) would cause it
        # to overlap with self.If an *outputmask* is specified, the
        # output is drawn onto*outputmask* and *outputmask* is
        # returned. Otherwise a mask ofsize size + *mask*.size - (1, 1)
        # is created.
        m1 = random_mask((100,100))
        m2 = random_mask((100,100))
        conv = m1.convolve(m2)
        for i in range(conv.size[0]):
            for j in range(conv.size[1]):
                self.assertEquals(conv.get_at((i,j)) == 0,
                                  m1.overlap(m2, (i - 99, j - 99)) is None)

    def test_pygame2_mask_Mask_draw(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.draw:

        # Mask.draw (mask, x, y) -> None
        # 
        # Draws the passed Mask onto the Mask.
        # 
        # Mask.draw (mask, x, y) -> None  Draws the passed Mask onto the Mask.
        # This performs a bitwise OR operation upon the calling Mask. The
        # passed mask's start offset for the draw operation will be the x and
        # y offset passed to the method.
        m = Mask (100, 100)
        self.assertEqual(m.count, 0)
        
        m.fill()
        self.assertEqual(m.count, 10000)
        
        m2 = Mask (10,10)
        m2.fill()
        m.erase (m2, (50, 50))
        self.assertEqual(m.count, 9900)
        
        m.invert()
        self.assertEqual(m.count, 100)
        
        m.draw(m2, (0,0))
        self.assertEqual(m.count, 200)    
        
        m.clear()
        self.assertEqual(m.count, 0)

    def todo_test_pygame2_mask_Mask_erase(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.erase:

        # Mask.erase (mask, x, y) -> None
        # 
        # Erases the passed Mask from the Mask.
        # 
        # Mask.erase (mask, x, y) -> None  Erases the passed Mask from the
        # Mask.  This performs a bitwise NAND operation upon the calling Mask.
        # The passed mask's start offfset for the erase operation will be the
        # x and y offset passed to the method.

        self.fail() 

    def test_pygame2_mask_Mask_fill(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.fill:

        # Mask.fill () -> None
        # 
        # Sets all bits to 1 within the Mask.
        m = Mask((100,100))
        self.assertEqual(m.count, 0)
        
        m.fill()
        self.assertEqual(m.count, 10000)

    def todo_test_pygame2_mask_Mask_get_at(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.get_at:

        # Mask.get_at (x, y) -> int
        # 
        # Gets the bit value at the desired location.

        self.fail() 

    def test_pygame2_mask_Mask_get_bounding_rects(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.get_bounding_rects:

        # Mask.get_bounding_rects () -> [Mask, Mask ...]
        # 
        # Returns a list of bounding rects of regions of set pixels.
        # 
        # Mask.get_bounding_rects () -> [Mask, Mask ...]  Returns a list of
        # bounding rects of regions of set pixels.  This gets a bounding rect
        # of connected regions of set bits. A bounding rect is one for which
        # each of the connected pixels is inside the rect.
        m = Mask (10, 10)
        m.set_at(0, 0, 1)
        m.set_at(1, 0, 1)

        m.set_at(0, 1, 1)

        m.set_at(0,3, 1)
        m.set_at(3,3, 1)
        
        r = m.get_bounding_rects()

        self.assertEquals(repr(r), "[(0, 0, 2, 2), (0, 3, 1, 1), (3, 3, 1, 1)]")

        #1100
        #1111
        m = Mask(4,2)
        m.set_at(0,0, 1)
        m.set_at(1,0, 1)
        m.set_at(2,0, 0)
        m.set_at(3,0, 0)

        m.set_at(0,1, 1)
        m.set_at(1,1, 1)
        m.set_at(2,1, 1)
        m.set_at(3,1, 1)
 
        r = m.get_bounding_rects()
        self.assertEquals(repr(r), "[(0, 0, 4, 2)]")

        #00100
        #01110
        #00100
        m = Mask(5,3)
        m.set_at(0,0, 0)
        m.set_at(1,0, 0)
        m.set_at(2,0, 1)
        m.set_at(3,0, 0)
        m.set_at(4,0, 0)

        m.set_at(0,1, 0)
        m.set_at(1,1, 1)
        m.set_at(2,1, 1)
        m.set_at(3,1, 1)
        m.set_at(4,1, 0)

        m.set_at(0,2, 0)
        m.set_at(1,2, 0)
        m.set_at(2,2, 1)
        m.set_at(3,2, 0)
        m.set_at(4,2, 0)

        r = m.get_bounding_rects()
        self.assertEquals(repr(r), "[(1, 0, 3, 3)]")

        #00010
        #00100
        #01000
        m = Mask(5,3)
        m.set_at(0,0, 0)
        m.set_at(1,0, 0)
        m.set_at(2,0, 0)
        m.set_at(3,0, 1)
        m.set_at(4,0, 0)

        m.set_at(0,1, 0)
        m.set_at(1,1, 0)
        m.set_at(2,1, 1)
        m.set_at(3,1, 0)
        m.set_at(4,1, 0)

        m.set_at(0,2, 0)
        m.set_at(1,2, 1)
        m.set_at(2,2, 0)
        m.set_at(3,2, 0)
        m.set_at(4,2, 0)

        r = m.get_bounding_rects()
        self.assertEquals(repr(r), "[(1, 0, 3, 3)]")

        #00011
        #11111
        m = Mask(5,2)
        m.set_at(0,0, 0)
        m.set_at(1,0, 0)
        m.set_at(2,0, 0)
        m.set_at(3,0, 1)
        m.set_at(4,0, 1)

        m.set_at(0,1, 1)
        m.set_at(1,1, 1)
        m.set_at(2,1, 1)
        m.set_at(3,1, 1)
        m.set_at(3,1, 1)
 
        r = m.get_bounding_rects()
        self.assertEquals(repr(r), "[(0, 0, 5, 2)]")

    def todo_test_pygame2_mask_Mask_height(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.height:

        # Gets the height of the Mask.

        self.fail() 

    def todo_test_pygame2_mask_Mask_invert(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.invert:

        # Mask.invert () -> None
        # 
        # Inverts all bits in the Mask.

        self.fail() 

    def test_pygame2_mask_Mask_outline(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.outline:
        m = Mask (20, 20)
        self.assertEqual(m.outline(), [])
        
        m.set_at(10, 10, 1)
        self.assertEqual(m.outline(), [(10,10)])
        
        m.set_at( 10, 12, 1)
        self.assertEqual(m.outline(10), [(10,10)])
        
        m.set_at(11, 11, 1)
        self.assertEqual(m.outline(), [(10,10), (11,11), (10,12), (11,11),
                                       (10,10)])
        self.assertEqual(m.outline(2), [(10,10), (10,12), (10,10)])

    def todo_test_pygame2_mask_Mask_overlap(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.overlap:

        # Mask.overlap (mask, x, y) -> int, int
        # 
        # Returns nonzero if the masks overlap with the given offset.
        # 
        # Mask.overlap (mask, x, y) -> int, int  Returns nonzero if the masks
        # overlap with the given offset.  The overlap tests uses the following
        # offsets (which may be negative):  +----+----------.. |A   | yoffset
        # |  +-+----------.. +--|B |xoffset |  | :  :
        # 
        # Mask.overlap (mask, x, y) -> int, int  Returns nonzero if the masks
        # overlap with the given offset.  The overlap tests uses the following
        # offsets (which may be negative):  +----+----------.. |A   | yoffset
        # |  +-+----------.. +--|B |xoffset |  | :  :

        self.fail() 

    def todo_test_pygame2_mask_Mask_overlap_area(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.overlap_area:

        # Mask.overlap_area (mask, x, y) -> int
        # 
        # Returns the number of overlapping bits of two Masks.
        # 
        # Mask.overlap_area (mask, x, y) -> int  Returns the number of
        # overlapping bits of two Masks.  This returns how many pixels overlap
        # with the other mask given. It can be used to see in which direction
        # things collide, or to see how much the two masks collide.

        self.fail() 

    def todo_test_pygame2_mask_Mask_overlap_mask(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.overlap_mask:

        # Mask.overlap_mask (mask, x, y) -> Mask.
        # 
        # Returns a mask with the overlap of two other masks. A bitwise AND.

        self.fail() 

    def todo_test_pygame2_mask_Mask_scale(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.scale:

        # Mask.scale (width, height) -> Mask
        # 
        # Creates a new scaled Mask with the given width and height.
        # 
        # Mask.scale (width, height) -> Mask  Creates a new scaled Mask with
        # the given width and height.  The quality of the scaling may not be
        # perfect for all circumstances, but it should be reasonable. If
        # either w or h is 0 a clear 1x1 mask is returned.

        self.fail() 

    def test_pygame2_mask_Mask_set_at(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.set_at:

        # Mask.set_at (x, y) -> None
        # 
        # Sets the bit value at the desired location.
        m = Mask (10, 10)
        m.set_at (0, 0, 1)
        self.assertEqual(m.get_at(0, 0), 1)
        m.set_at(9, 0, 1)
        self.assertEqual(m.get_at(9, 0), 1)

        # out of bounds, should get IndexError
        self.assertRaises(IndexError, lambda : m.get_at (-1,0) )
        self.assertRaises(IndexError, lambda : m.set_at (-1, 0, 1) )
        self.assertRaises(IndexError, lambda : m.set_at (10, 0, 1) )
        self.assertRaises(IndexError, lambda : m.set_at (0, 10, 1) )

    def todo_test_pygame2_mask_Mask_size(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.size:

        # Mask (width, height) -> Mask
        # 
        # Creates a new, empty Mask with the desired dimensions.
        # 
        # Mask (width, height) -> Mask  Creates a new, empty Mask with the
        # desired dimensions.  The Mask is a 2D array using single bits to
        # represent states within a x,y matrix. This makes it suitable for
        # pixel-perfect overlap handling of image buffers.

        self.fail() 

    def todo_test_pygame2_mask_Mask_width(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.Mask.width:

        # Gets the width of the Mask

        self.fail() 

    def test_pygame2_mask_from_surface(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.from_surface:

        # pygame2.mask.from_surface (surface, threshold) -> Mask
        # 
        # Returns a Mask from the given pygame2.sdl.video.Surface.
        # 
        # pygame2.mask.from_surface (surface, threshold) -> Mask  Returns a
        # Mask from the given pygame2.sdl.video.Surface.  Makes the
        # transparent parts of the Surface not set, and the opaque parts set.
        # The alpha of each pixel is checked to see if it is greater than the
        # given threshold. If the Surface is color keyed, then threshold is
        # not used.  This requires pygame2 to be built with SDL support
        # enabled.
        # 
        # This requires pygame2 to be built with SDL support enabled.
        video.init ()
        
        mask_from_surface = pygame2.mask.from_surface

        surf = video.Surface(70, 70, 32, sdlconst.SRCALPHA)
        surf.fill(pygame2.Color(255,255,255,255))

        amask = mask_from_surface (surf)

        self.assertEqual(amask.get_at(0,0), 1)
        self.assertEqual(amask.get_at(66,1), 1)
        self.assertEqual(amask.get_at(69,1), 1)

        surf.set_at(0,0, pygame2.Color(255,255,255,127))
        surf.set_at(1,0, pygame2.Color(255,255,255,128))
        surf.set_at(2,0, pygame2.Color(255,255,255,0))
        surf.set_at(3,0, pygame2.Color(255,255,255,255))

        amask = mask_from_surface(surf)
        self.assertEqual(amask.get_at(0,0), 0)
        self.assertEqual(amask.get_at(1,0), 1)
        self.assertEqual(amask.get_at(2,0), 0)
        self.assertEqual(amask.get_at(3,0), 1)

        surf.fill(pygame2.Color(255,255,255,0))
        amask = mask_from_surface(surf)
        self.assertEqual(amask.get_at(0, 0), 0)

    def test_pygame2_mask_from_threshold(self):

        # __doc__ (as of 2008-11-03) for pygame2.mask.from_threshold:

        # TODO
        video.init ()
        a = [16, 24, 32]
        
        for i in a:
            surf = video.Surface (70, 70, i)
            surf.fill (pygame2.Color (100,50,200), pygame2.Rect (20,20,20,20))
            mask = pygame2.mask.from_threshold (surf,
                                                pygame2.Color (100,50,200,255),
                                                pygame2.Color (10,10,10,255))
            
            self.assertEqual (mask.count, 400)
            self.assertEqual (mask.get_bounding_rects (),
                              [pygame2.Rect (20, 20, 20, 20)])
            
        for i in a:
            surf = video.Surface (70, 70, i)
            surf2 = video.Surface (70,70, i)
            surf.fill (pygame2.Color (100, 100, 100))
            surf2.fill (pygame2.Color (150, 150, 150))
            surf2.fill (pygame2.Color (100, 100, 100),
                        pygame2.Rect (40, 40, 10, 10))
            mask = pygame2.mask.from_threshold(surf, pygame2.Color (0, 0, 0, 0),
                                               pygame2.Color (10, 10, 10, 255),
                                               surf2)
            
            self.assertEqual (mask.count, 100)
            self.assertEqual (mask.get_bounding_rects(),
                              [pygame2.Rect (40, 40, 10, 10)])

    def test_drawing (self):
        """ Test fill, clear, invert, draw, erase
        """
        m = Mask((100,100))
        self.assertEqual(m.count, 0)
        
        m.fill()
        self.assertEqual(m.count, 10000)

        m2 = Mask((10,10))
        m2.fill()
        m.erase(m2, (50,50))
        self.assertEqual(m.count, 9900)
        
        m.invert()
        self.assertEqual(m.count, 100)
        
        m.draw(m2, (0,0))
        self.assertEqual(m.count, 200)    
        
        m.clear()
        self.assertEqual(m.count, 0)


    def test_convolve__size(self):
        sizes = [(1,1), (31,31), (32,32), (100,100)]
        for s1 in sizes:
            m1 = Mask(s1)
            for s2 in sizes:
                m2 = Mask(s2)
                o = m1.convolve(m2)
                for i in (0,1):
                    self.assertEquals(o.size[i], m1.size[i] + m2.size[i] - 1)

    def test_convolve__point_identities(self):
        """Convolving with a single point is the identity, while
        convolving a point with something flips it."""
        m = random_mask((100,100))
        k = Mask((1,1))
        k.set_at((0,0))

        self.assertMaskEquals(m,m.convolve(k))
        self.assertMaskEquals(m,k.convolve(k.convolve(m)))

    def test_convolve__with_output(self):
        """checks that convolution modifies only the correct portion of
        the output"""
        m = random_mask((10,10))
        k = Mask((2,2))
        k.set_at((0,0))

        o = Mask((50,50))
        test = Mask((50,50))

        m.convolve(k,o)
        test.draw(m,(1,1))
        self.assertMaskEquals(o, test)

        o.clear()
        test.clear()

        m.convolve(k,o, (10,10))
        test.draw(m,(11,11))
        self.assertMaskEquals(o, test)

    def test_convolve__out_of_range(self):
        full = Mask((2,2))
        full.fill()

        self.assertEquals(full.convolve(full, None, ( 0,  3)).count, 0)
        self.assertEquals(full.convolve(full, None, ( 0,  2)).count, 3)
        self.assertEquals(full.convolve(full, None, (-2, -2)).count, 1)
        self.assertEquals(full.convolve(full, None, (-3, -3)).count, 0)

if __name__ == "__main__":
    unittest.main ()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.