def test_make_even_mask_from_negative_indices(self): indices_to_punch = [-12, -10, -8, -6, -4, -2] evens = Mask.from_indices(size=12, indices_to_punch=indices_to_punch) self.assertEqual(self.even_are_punched, evens)
def test_make_odd_mask_from_negative_indices(self): indices_to_punch = [-11, -9, -7, -5, -3, -1] odds = Mask.from_indices(size=12, indices_to_punch=indices_to_punch) self.assertEqual(self.odd_are_punched, odds)
def test_make_odd_mask_from_indices(self): indices_to_punch = [1, 3, 5, 7, 9, 11] odds = Mask.from_indices(size=12, indices_to_punch=indices_to_punch) self.assertEqual(self.odd_are_punched, odds)
def test_make_even_mask_from_indices(self): indices_to_punch = [0, 2, 4, 6, 8, 10] evens = Mask.from_indices(size=12, indices_to_punch=indices_to_punch) self.assertEqual(self.even_are_punched, evens)
def test_make_mask_from_indices_too_small(self): with self.assertRaises(AssertionError) as context: indices_to_punch = [-13, -10, -2] evens = Mask.from_indices(size=12, indices_to_punch=indices_to_punch) self.assertEqual(self.even_are_punched, evens)
def test_make_mask_from_indices_too_large(self): with self.assertRaises(AssertionError) as context: indices_to_punch = [0, 2, 4, 14, 10] evens = Mask.from_indices(size=12, indices_to_punch=indices_to_punch)
def test_make_mask_from_indices_size_is_0(self): with self.assertRaises(AssertionError) as context: indices_to_punch = [0, 2, 4, 6, 8, 10] evens = Mask.from_indices(size=0, indices_to_punch=indices_to_punch)