File tree 4 files changed +32
-0
lines changed
4 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,13 @@ Use it.
25
25
>> > HTMLSlacker(' <b>Hello</b>, <i>Slack</i>!' ).get_output()
26
26
' *Hello*, _Slack_!'
27
27
28
+ Test it.
29
+
30
+ .. code :: python
31
+
32
+ $ python setup.py test
33
+
34
+
28
35
Requirements
29
36
------------
30
37
Original file line number Diff line number Diff line change 1
1
[metadata]
2
2
description-file = README.rst
3
+
4
+ [aliases]
5
+ test =pytest
Original file line number Diff line number Diff line change
1
+ import sys
1
2
from setuptools import setup , find_packages
2
3
from os .path import join , dirname
3
4
5
+ needs_pytest = {'pytest' , 'test' , 'ptr' }.intersection (sys .argv )
6
+ pytest_runner = ['pytest-runner' ] if needs_pytest else []
7
+
4
8
setup (
5
9
name = 'html-slacker' ,
6
10
packages = find_packages (),
19
23
'Topic :: Software Development :: Libraries' ,
20
24
'Environment :: Console' ,
21
25
],
26
+ setup_requires = pytest_runner ,
27
+ tests_require = ["pytest" ],
22
28
python_requires = '>=2.5'
23
29
)
Original file line number Diff line number Diff line change
1
+ from htmlslacker import HTMLSlacker
2
+
3
+
4
+ def test_example_1 ():
5
+ html = """
6
+ <b>Hello</b><br>
7
+ There is <i>something</i> interesting about <code>this doc</code>
8
+
9
+ <p>
10
+ And <a href="http://example.com/">here is a
11
+ link in a paragraph!</a>
12
+ </p>
13
+ """
14
+ expected = "*Hello*\n There is _something_ interesting about `this doc` \n And <http://example.com/|here is a link in a paragraph!>"
15
+ output = HTMLSlacker (html ).get_output ()
16
+ assert (output == expected )
You can’t perform that action at this time.
0 commit comments