Skip to content

Commit

Permalink
refs #31 -- basic slugification test structure
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobord committed Aug 13, 2016
1 parent bf77a86 commit 6a31e5f
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
.tox/
build/

# py.test related
.cache/
4 changes: 4 additions & 0 deletions build-requirements.pip
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
py-gfm
PyYAML
shell
cached-property
4 changes: 3 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import yaml



SOURCE_FILE_TEXT = '<p><a href="{source_file}">Link to {source_file_basename}</a></p>' # noqa
HTACCESS = """
# Serving .md files as UTF-8.
Expand All @@ -24,9 +25,10 @@
DEFAULT_PAGE = {}



class Builder(object):

exceptions = ('.tox', '.git', 'build', 'static', 'templates')
exceptions = ('.tox', '.git', 'build', 'static', 'templates', 'tests',)

def __init__(self):
self.build_path = abspath('build')
Expand Down
1 change: 1 addition & 0 deletions test-requirements.pip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest
1 change: 1 addition & 0 deletions tests/test_slugify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ..toolbox import slugify
1 change: 1 addition & 0 deletions toolbox/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from markdown.extensions.headerid import slugify
Empty file added toolbox/tests/__init__.py
Empty file.
20 changes: 20 additions & 0 deletions toolbox/tests/test_slugify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from .. import slugify


def test_slugify_english():
assert slugify('hello', '-') == 'hello'
assert slugify('hello world', '-') == 'hello-world'


def test_slugify_french():
assert slugify("De quoi s'agit-il ?", '-') == 'de-quoi-sagit-il'


def test_slugify_castellano():
assert slugify("¿Qué es esto?", '-') == 'que-es-esto'


def test_slugify_converting_saves():
assert slugify('Converting Saves', '-') == 'converting-saves'
assert slugify('Conversion des jets de sauvegarde', '-') == 'conversion-des-jets-de-sauvegarde' # noqa
assert slugify('Convirtiendo tiradas de salvación', '-') == 'convirtiendo-tiradas-de-salvacion' # noqa
18 changes: 12 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
[tox]
envlist = build
envlist = build,test
skipsdist = True

[testenv]
basepython = python3.4
deps =
py-gfm
PyYAML
shell
cached-property
-rbuild-requirements.pip
# For debuggin purposes
ipdb
# ipdb
commands =
python build.py


[testenv:test]
basepython = python3.4
deps =
-rbuild-requirements.pip
-rtest-requirements.pip
commands =
py.test toolbox

0 comments on commit 6a31e5f

Please # to comment.