stoichiograph

Spell words with elemental symbols from the periodic table.
git clone git://git.amin.space/stoichiograph.git
Log | Files | Refs | LICENSE

commit d2dcd88d5a9cefc71c89bedd87045fceabb58e47
parent 93f8d349ea862040e2dd08b4c3dc9d9f1f69c1b8
Author: amin <dev@aminmesbah.com>
Date:   Fri, 13 Jan 2017 08:09:18 +0000

Change elemental_speller to speller.

FossilOrigin-Name: d20b94112f48731a0b836d046c3cf0498c68170e2373dbb12cf7a596fb89c14f
Diffstat:
MREADME.rst | 4++--
Mspellement.py | 10+++++-----
Relemental_speller.py -> speller.py | 0
Mtests.py | 20++++++++++----------
4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/README.rst b/README.rst @@ -1,5 +1,5 @@ -Elemental Speller -================= +Spellement +========== Spell words with elemental symbols from the periodic table ("He", "Cu", etc). diff --git a/spellement.py b/spellement.py @@ -6,7 +6,7 @@ import json import logging import pathlib -import elemental_speller as es +import speller __title__ = 'Elemental Speller' __author__ = 'Amin Mesbah' @@ -70,8 +70,8 @@ def main(): raise SystemExit if args.list_elements: - print('{} Elements:'.format(len(es.ELEMENTS))) - print(sorted(list(es.ELEMENTS))) + print('{} Elements:'.format(len(speller.ELEMENTS))) + print(sorted(list(speller.ELEMENTS))) raise SystemExit if args.debug: @@ -113,9 +113,9 @@ def main(): for word in words: if TUPLES: - spellings = es.spell(word) + spellings = speller.spell(word) else: - spellings = [''.join(s) for s in es.spell(word)] + spellings = [''.join(s) for s in speller.spell(word)] if spellings: spellable[word] = spellings diff --git a/elemental_speller.py b/speller.py diff --git a/tests.py b/tests.py @@ -1,5 +1,5 @@ import pytest -import elemental_speller as es +import speller ELEMENTS = ( 'H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', @@ -16,32 +16,32 @@ ELEMENTS = ( def test_verify_data(): - assert es.ELEMENTS == ELEMENTS + assert speller.ELEMENTS == ELEMENTS def test_groupings(): - assert es.generate_groupings(4, batch_sizes=()) == () + assert speller.generate_groupings(4, batch_sizes=()) == () - assert es.generate_groupings(4, batch_sizes=(1, 2)) == ( + assert speller.generate_groupings(4, batch_sizes=(1, 2)) == ( (2, 2), (1, 1, 2), (1, 2, 1), (2, 1, 1), (1, 1, 1, 1) ) - assert es.generate_groupings(4, batch_sizes=(1, 2, 3)) == ( + assert speller.generate_groupings(4, batch_sizes=(1, 2, 3)) == ( (1, 3), (2, 2), (3, 1), (1, 1, 2), (1, 2, 1), (2, 1, 1), (1, 1, 1, 1) ) def test_map_word(): - assert es.map_word('because', (1, 2, 1, 1, 2)) == ('b', 'ec', 'a', 'u', 'se') - assert es.map_word('osiris', (1, 3, 2)) == ('o', 'sir', 'is') + assert speller.map_word('because', (1, 2, 1, 1, 2)) == ('b', 'ec', 'a', 'u', 'se') + assert speller.map_word('osiris', (1, 3, 2)) == ('o', 'sir', 'is') with pytest.raises(ValueError): - es.map_word('toolong', (2, 1)) - es.map_word('short', (2, 2, 2)) + speller.map_word('toolong', (2, 1)) + speller.map_word('short', (2, 2, 2)) def test_elemental_spelling(): - assert es.spell('amputation') == [ + assert speller.spell('amputation') == [ ('Am', 'Pu', 'Ta', 'Ti', 'O', 'N'), ('Am', 'P', 'U', 'Ta', 'Ti', 'O', 'N') ]