Validation¶
Note
These methods are used internally, but there’s no reason they can’t be used externally.
-
towers.core.validation.validate_height(height)[source]¶ Validate the height of a
Tower`s or :class:`Rod.Parameters: height (int) – The height to validate. Raises: InvalidTowerHeight – The height of the Toweris invalid.
-
towers.core.validation.validate_rods(rods)[source]¶ Validate the rods.
Parameters: rods (List[Rod]|None) – The
Rod’s to validate.Raises: - InvalidRods – expecting type
Rods. - DuplicateDisk – This
Rodalready contains thisDisk - CorruptRod – A
Diskis on top of aDiskof smaller size.
- InvalidRods – expecting type
-
towers.core.validation.validate_moves(moves)[source]¶ Validate the number of moves.
Parameters: moves (int) – The moves count to validate. Raises: InvalidMoves – The number of moves is not an number or is less than zero.