Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' of https://github.com/mkasfeldt/Alphanumeric-In…

  • Loading branch information...
commit 7847ed9687cff8fd4289f7f29542982f80680c52 2 parents 770c8ad + 6fdc0b2
mkasfeldt authored

Showing 2 changed files with 83 additions and 0 deletions. Show diff stats Hide diff stats

  1. +27 0 .gitignore
  2. +56 0 README.md
27 .gitignore
... ... @@ -0,0 +1,27 @@
  1 +*.py[co]
  2 +
  3 +# Packages
  4 +*.egg
  5 +*.egg-info
  6 +dist
  7 +build
  8 +eggs
  9 +parts
  10 +bin
  11 +var
  12 +sdist
  13 +develop-eggs
  14 +.installed.cfg
  15 +
  16 +# Installer logs
  17 +pip-log.txt
  18 +
  19 +# Unit test / coverage reports
  20 +.coverage
  21 +.tox
  22 +
  23 +#Translations
  24 +*.mo
  25 +
  26 +#Mr Developer
  27 +.mr.developer.cfg
56 README.md
Source Rendered
... ... @@ -0,0 +1,56 @@
  1 +Alphanumeric-Incementor
  2 +=======================
  3 +
  4 +simple function to increment a alpha-numeric key to the next value
  5 +note value follows: 0 < A < a therefor 9 is less than P and Z is less than b
  6 +:param value: The value passed to the function
  7 +:type value: String
  8 +:param onlycaps: Use only capital letters, defaults to True
  9 +:type onlycaps: Boolean
  10 +:param increment: Number of increments to add, defaults to 1
  11 +:type increment: Integer
  12 +:param strlen: length of the value
  13 +:type maxlen: Integer
  14 +:return: the incremented value
  15 +:rtype: String
  16 +values that should pass
  17 +
  18 +>>> anIncrement('0000000000')
  19 +'0000000001'
  20 +>>> anIncrement('0000000009')
  21 +'000000000A'
  22 +>>> anIncrement('000000000Z')
  23 +'0000000010'
  24 +>>> anIncrement('000000000Z',onlycaps=False)
  25 +'000000000a'
  26 +>>> anIncrement('000000000z',onlycaps=False)
  27 +'0000000010'
  28 +>>> anIncrement('00000000z',strlen=9,onlycaps=False)
  29 +'000000010'
  30 +
  31 +values that should raise exceptions
  32 +
  33 +>>> anIncrement('zzzzzzzzzz',onlycaps=False)
  34 +Traceback (most recent call last):
  35 + ...
  36 +RuntimeError: incremented value greater than the maximum permitted value
  37 +>>> anIncrement('ZZZZZZZZZZ')
  38 +Traceback (most recent call last):
  39 + ...
  40 +RuntimeError: incremented value greater than the maximum permitted value
  41 +>>> anIncrement('000000000')
  42 +Traceback (most recent call last):
  43 + ...
  44 +ValueError: input value not equal to required string length:10
  45 +>>> anIncrement('000000000a')
  46 +Traceback (most recent call last):
  47 + ...
  48 +ValueError: input value has non-numeric or non-capitalized-letter characters
  49 +>>> anIncrement('000000000!',onlycaps=False)
  50 +Traceback (most recent call last):
  51 + ...
  52 +ValueError: input value has non-numeric or non-letter characters
  53 +>>> anIncrement('00000000a!',onlycaps=False)
  54 +Traceback (most recent call last):
  55 + ...
  56 +ValueError: input value has non-numeric or non-letter characters

0 comments on commit 7847ed9

Please sign in to comment.
Something went wrong with that request. Please try again.