Skip to content

Commit

Permalink
Added doctests for hgvs/utils/norm.py (#548)
Browse files Browse the repository at this point in the history
* Added doctest for hgvs/utils/__init__.py
* Added doctest for hgvs/utils/norm.py
  • Loading branch information
langitem authored and reece committed Feb 25, 2019
1 parent f099366 commit df66cef
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions hgvs/utils/norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@


def trim_common_suffixes(strs, min_len=0):
"""trim common suffixes"""
"""
trim common suffixes
>>> trim_common_suffixes('A', 1)
(0, 'A')
"""

if len(strs) < 2:
return 0, strs
Expand Down Expand Up @@ -48,7 +54,13 @@ def trim_common_prefixes(strs, min_len=0):


def normalize_alleles_left(ref, start, stop, alleles, bound, ref_step, shuffle=True):
"""Normalize loci by removing extraneous reference padding"""
"""
Normalize loci by removing extraneous reference padding
>>> normalize_alleles_left('A', 1, 2, 'A', 1, 2)
shuffled_alleles(start=1, stop=2, alleles='A')
"""

normalized_alleles = namedtuple('shuffled_alleles', 'start stop alleles')

Expand Down Expand Up @@ -92,7 +104,13 @@ def normalize_alleles_left(ref, start, stop, alleles, bound, ref_step, shuffle=T


def normalize_alleles_right(ref, start, stop, alleles, bound, ref_step, shuffle=True):
"""Normalize loci by removing extraneous reference padding"""
"""
Normalize loci by removing extraneous reference padding
>>> normalize_alleles_right('A', 1, 2, 'A', 1, 2)
shuffled_alleles(start=1, stop=2, alleles='A')
"""

normalized_alleles = namedtuple('shuffled_alleles', 'start stop alleles')

Expand Down

0 comments on commit df66cef

Please sign in to comment.