def test_preset_index_with_all_presets_filled(self): p = PresetIndex() p.count = 64 p.indexes = [num for num in range(0, 64)] # Should have 64 presets self.assertEqual(64, p.number_of_presets) # And no free slots self.assertIsNone(p.first_empty_index_position)
def test_throws_exception_if_index_out_of_range(self): p = PresetIndex() p.count = 4 p.set_indexes([0, 1, 2, 3, 255]) self.assertEqual(p.number_of_presets, 4) self.assertFalse(p.is_valid_index(4)) self.assertFalse(p.is_valid_index(-1)) self.assertTrue(p.is_valid_index(0)) self.assertTrue(p.is_valid_index(1)) self.assertTrue(p.is_valid_index(3))
def test_preset_indexes_are_swapped_ok(self): p = PresetIndex() p.count = 4 p.indexes = [0, 1, 2, 3, 255] p.swap(0, 3) self.assertEqual([3, 1, 2, 0, 255], p.indexes)