Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
Choose a Base Repository
base: master
Choose a Head Repository
compare: master
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 11 files changed
  • 0 commit comments
  • 1 contributor
Commits on Sep 17, 2016
@@ -0,0 +1,16 @@
language: python
python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"
install:
- pip install -q Markdown
script:
- PYTHONPATH=. python tests/without_mdx_unimoji_extension.py
- PYTHONPATH=. python tests/with_mdx_unimoji_extension.py
- PYTHONPATH=. python tests/with_emoji_overrides_option.py
- PYTHONPATH=. python tests/with_styles_overrides_option.py
- PYTHONPATH=. python tests/with_span_class_option.py
- PYTHONPATH=. python tests/with_span_class_option_none.py
- PYTHONPATH=. python tests/with_both_options.py
@@ -0,0 +1,79 @@
# coding: utf-8
from __future__ import unicode_literals

from unittest import main, TestCase
from markdown import markdown
from mdx_unimoji import UnimojiExtension


class Test(TestCase):
def test_markdown_without_emoji_extension(self):
text = 'I <3 you! Just kidding. :P'
should_be = '<p>I &lt;3 you! Just kidding. :P</p>'
result = markdown(text, extensions=[])
self.assertEqual(should_be, result)

def test_without_emojis(self):
text = 'I love you! Just kidding. *smile*'
should_be = '<p>I love you! Just kidding. <em>smile</em></p>'
result = markdown(text, extensions=[])
self.assertEqual(should_be, result)

def test_with_emojis(self):
text = 'I <3 you! Just kidding. :P'
# should_be = '<p>I <span class="emoji" style="color:red">❤</span> you! Just kidding. <span class="emoji">😛</span></p>'
should_be = '<p>I ❤ you! Just kidding. 😛</p>'
result = markdown(text, extensions=['mdx_unimoji'])
self.assertEqual(should_be, result)

def test_mdx_overrides_emoji_option(self):
img_heart = '<img alt="love" src="heart.png"/>'
img_tongue = '<img alt=":P" src="tongue.png"/>'
overrides = UnimojiExtension.EMOJI
overrides.update({
img_heart: ['<3'],
img_tongue: ':p :P :-p :-P'.split(),
})
text = 'I <3 you! Just kidding. :P'
should_be = '<p>I <img alt="love" class="emoji" src="heart.png" /> you! Just kidding. <img alt=":P" class="emoji" src="tongue.png" /></p>'
result = markdown(text, extensions=[UnimojiExtension(emoji=overrides)])
self.assertEqual(should_be, result)

def test_mdx_overrides_emoji_option(self):
overrides = UnimojiExtension.STYLES
overrides.update({
'': 'color:blue',
})
text = 'I <3 you! Just kidding. :P'
should_be = '<p>I <span class="emoji" style="color:blue">❤</span> you! Just kidding. <span class="emoji">😛</span></p>'
result = markdown(text, extensions=[UnimojiExtension(styles=overrides)])
self.assertEqual(should_be, result)

def test_mdx_span_class_option(self):
text = 'I <3 you! Just kidding. :P'
should_be = '<p>I <span class="other" style="color:red">❤</span> you! Just kidding. <span class="other">😛</span></p>'
result = markdown(text, extensions=[UnimojiExtension(span_class='other')])
self.assertEqual(should_be, result)

def test_mdx_span_class_none_option(self):

text = 'I <3 you! Just kidding. :P'
should_be = '<p>I ❤ you! Just kidding. 😛</p>'
result = markdown(text, extensions=[UnimojiExtension(span_class=None)])
self.assertEqual(should_be, result)

# def test_mdx_both_options(self):
# img_heart = '<img alt="love" src="heart.png"/>'
# img_tongue = '<img alt=":P" src="tongue.png"/>'
# overrides = UnimojiExtension.EMOJI
# overrides.update({img_heart: ['<3'],
# img_tongue: ':p :P :-p :-P'.split()})
# text = 'I <3 you! Just kidding. :P'
# should_be = '<p>I <img alt="love" class="other" src="heart.png" /> you! Just kidding. <span class="other">😛</span></p>'
# result = markdown(text,
# extensions=[UnimojiExtension(span_class='other',
# emoji=overrides)])
# self.assertEqual(should_be, result)

if __name__ == '__main__':
main()
No changes.
@@ -0,0 +1,26 @@
# coding: utf-8
from __future__ import unicode_literals

from unittest import main, TestCase

from markdown import markdown
from mdx_unimoji import UnimojiExtension


class Test(TestCase):
def test_mdx_both_options(self):
img_cake = '<img alt="cake" src="cake.png"/>'
img_wink = '<img alt="wink" src="wink.png"/>'
overrides = UnimojiExtension.EMOJI
overrides.update({img_cake: ['<3'],
img_wink: ';-) ;] ;-]'.split()})
text = 'This was a triumph. The :cake: is a lie. ;)'
# should_be = '<p>This was a triumph. The <img alt="cake" class="other" src="cake.png"> is a lie. <img alt="wink" class="other" src="wink.png"/></p>'
should_be = '<p>This was a triumph. The <span class="other" style="color:maroon">🍰</span> is a lie. <span class="other">😉</span></p>'
result = markdown(text,
extensions=[UnimojiExtension(span_class='other',
emoji=overrides)])
self.assertEqual(should_be, result)

if __name__ == '__main__':
main()
@@ -0,0 +1,26 @@
# coding: utf-8
from __future__ import unicode_literals

from unittest import main, TestCase

from markdown import markdown
from mdx_unimoji import UnimojiExtension


class Test(TestCase):
def test_mdx_overrides_emoji_option(self):
img_cake = '<img alt="cake" src="cake.png"/>'
img_wink = '<img alt="wink" src="wink.png"/>'
overrides = UnimojiExtension.EMOJI
overrides.update({
img_cake: [':cake:'],
img_wink: ';) ;-) ;] ;-]'.split(),

})
text = 'This was a triumph. The :cake: is a lie. ;)'
should_be = '<p>This was a triumph. The <img alt="cake" class="emoji" src="cake.png" /> is a lie. <img alt="wink" class="emoji" src="wink.png" /></p>'
result = markdown(text, extensions=[UnimojiExtension(emoji=overrides)])
self.assertEqual(should_be, result)

if __name__ == '__main__':
main()
@@ -0,0 +1,24 @@
# coding: utf-8
from __future__ import unicode_literals

from unittest import main, TestCase

from markdown import markdown
from mdx_unimoji import UnimojiExtension


class Test(TestCase):
def test_without_emojis(self):
text = 'This was a triumph. The *cake* is a lie.'
should_be = '<p>This was a triumph. The <em>cake</em> is a lie.</p>'
result = markdown(text, extensions=[])
self.assertEqual(should_be, result)

def test_with_emojis(self):
text = 'This was a triumph. The :cake: is a lie. ;)'
should_be = '<p>This was a triumph. The <span class="emoji" style="color:maroon">🍰</span> is a lie. <span class="emoji">😉</span></p>'
result = markdown(text, extensions=[UnimojiExtension()])
self.assertEqual(should_be, result)

if __name__ == '__main__':
main()
@@ -0,0 +1,18 @@
# coding: utf-8
from __future__ import unicode_literals

from unittest import main, TestCase

from markdown import markdown
from mdx_unimoji import UnimojiExtension


class Test(TestCase):
def test_mdx_span_class_option(self):
text = 'This was a triumph. The :cake: is a lie. ;)'
should_be = '<p>This was a triumph. The <span class="other" style="color:maroon">🍰</span> is a lie. <span class="other">😉</span></p>'
result = markdown(text, extensions=[UnimojiExtension(span_class='other')])
self.assertEqual(should_be, result)

if __name__ == '__main__':
main()
@@ -0,0 +1,18 @@
# coding: utf-8
from __future__ import unicode_literals

from unittest import main, TestCase

from markdown import markdown
from mdx_unimoji import UnimojiExtension


class Test(TestCase):
def test_mdx_span_class_none_option(self):
text = 'This was a triumph. The :cake: is a lie. ;)'
should_be = '<p>This was a triumph. The 🍰 is a lie. 😉</p>'
result = markdown(text, extensions=[UnimojiExtension(span_class=None)])
self.assertEqual(should_be, result)

if __name__ == '__main__':
main()
@@ -0,0 +1,22 @@
# coding: utf-8
from __future__ import unicode_literals

from unittest import main, TestCase

from markdown import markdown
from mdx_unimoji import UnimojiExtension


class Test(TestCase):
def test_mdx_overrides_emoji_option(self):
overrides = UnimojiExtension.STYLES
overrides.update({
'🍰': 'color:blue',
})
text = 'This was a triumph. The :cake: is a lie. ;)'
should_be = '<p>This was a triumph. The <span class="emoji" style="color:blue">🍰</span> is a lie. <span class="emoji">😉</span></p>'
result = markdown(text, extensions=[UnimojiExtension(styles=overrides)])
self.assertEqual(should_be, result)

if __name__ == '__main__':
main()
@@ -0,0 +1,17 @@
# coding: utf-8
from __future__ import unicode_literals

from unittest import main, TestCase

from markdown import markdown


class Test(TestCase):
def test_markdown_without_emoji_extension(self):
text = 'This was a triumph. The :cake: is a lie. ;)'
should_be = '<p>This was a triumph. The :cake: is a lie. ;)</p>'
result = markdown(text, extensions=[])
self.assertEqual(should_be, result)

if __name__ == '__main__':
main()
25 tox.ini
@@ -0,0 +1,25 @@
[tox]
envlist = py27, py33, py34, py35

[testenv]
commands=\
python tests/without_mdx_unimoji_extension.py \
python tests/with_mdx_unimoji_extension.py \
python tests/with_emoji_overrides_option.py \
python tests/with_styles_overrides_option.py \
python tests/with_span_class_option.py \
python tests/with_span_class_option_none.py \
python tests/with_both_options.py
setenv=PYTHONPATH=.

[testenv:py27]
basepython = python2.7

[testenv:py33]
basepython = python3.3

[testenv:py34]
basepython = python3.4

[testenv:py35]
basepython = python3.5

No commit comments for this range

You can’t perform that action at this time.