stoichiograph

Spell words with elemental symbols from the periodic table.
Log | Files | Refs | LICENSE

commit ef12c09ff8f4195d00e0842d0b8647a6a86b27e8
parent 2b1904d92be20ada569a04eef9b622d56d83812b
Author: Amin Mesbah <mesbah.amin@gmail.com>
Date:   Fri, 13 Jan 2017 00:09:18 -0800

Change elemental_speller to speller.

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') ]