Skip to content

Commit c722303

Browse files
committed
Added test functions comments
1 parent b8e6dfd commit c722303

File tree

5 files changed

+16
-15
lines changed

5 files changed

+16
-15
lines changed

icon_font_to_png/command_line.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
import argparse
55

6-
from icon_font_to_png import *
6+
from icon_font_to_png import IconFont, AVAILABLE_ICON_FONTS
77

88

99
def run(arguments):

icon_font_to_png/test/test_command_line.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_icon_export(capfd):
8787

8888

8989
def test_filename_option(capfd):
90-
"""Test file names"""
90+
"""Test filename option"""
9191
css_file = os.path.join('files', 'font-awesome.css')
9292
ttf_file = os.path.join('files', 'fontawesome-webfont.ttf')
9393

@@ -129,7 +129,7 @@ def test_download_option(capfd):
129129

130130

131131
# Teardown
132-
def teardown_module(module):
132+
def teardown_module():
133133
"""Delete exported icons directory and downloaded FontAwesome files"""
134134
if os.path.isdir('exported'):
135135
shutil.rmtree('exported')

icon_font_to_png/test/test_font_awesome.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
@pytest.fixture(scope='module')
1111
def font_awesome():
12+
"""Create a IconFont instance from Font Awesome files"""
1213
css_file = os.path.join('files', 'font-awesome.css')
1314
ttf_file = os.path.join('files', 'fontawesome-webfont.ttf')
14-
font = icon_font.IconFont(css_file=css_file, ttf_file=ttf_file)
15-
return font
15+
return icon_font.IconFont(css_file=css_file, ttf_file=ttf_file)
1616

1717

1818
def test_font_awesome_load_icons(font_awesome):
@@ -28,7 +28,7 @@ def test_font_awesome_prefix(font_awesome):
2828
def test_font_awesome_export_icon(font_awesome):
2929
"""Test Font Awesome random icon exporting"""
3030
icon = random.choice(list(font_awesome.css_icons.keys()))
31-
font_awesome.export_icon(icon=icon, size=128, export_dir='/tmp')
32-
font_awesome.export_icon(icon=icon, size=128, color='blue', export_dir='/tmp')
33-
font_awesome.export_icon(icon=icon, size=256, export_dir='/tmp')
34-
font_awesome.export_icon(icon=icon, size=256, color='blue', export_dir='/tmp')
31+
font_awesome.export_icon(icon, size=128, export_dir='/tmp')
32+
font_awesome.export_icon(icon, size=128, color='blue', export_dir='/tmp')
33+
font_awesome.export_icon(icon, size=256, export_dir='/tmp')
34+
font_awesome.export_icon(icon, size=256, color='blue', export_dir='/tmp')

icon_font_to_png/test/test_icon_font.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@
1313
# Module fixtures
1414
@pytest.fixture(scope='module')
1515
def font_awesome():
16+
"""Create a IconFont instance from Font Awesome files"""
1617
css_file = os.path.join('files', 'font-awesome.css')
1718
ttf_file = os.path.join('files', 'fontawesome-webfont.ttf')
18-
font = icon_font.IconFont(css_file=css_file, ttf_file=ttf_file)
19-
return font
19+
return icon_font.IconFont(css_file=css_file, ttf_file=ttf_file)
2020

2121

2222
# Tests
2323
def test_init():
2424
"""Test initializing"""
25-
2625
# No arguments
2726
with pytest.raises(TypeError):
2827
icon_font.IconFont()
@@ -79,6 +78,7 @@ def test_size(font_awesome, image, size):
7978
("rocket_123123.png", '#123123'),
8079
])
8180
def test_color(font_awesome, image, color):
81+
"""Test color option"""
8282
original_file = os.path.join('files', image)
8383

8484
font_awesome.export_icon(icon='rocket', size=16, color=color)
@@ -97,6 +97,7 @@ def test_color(font_awesome, image, color):
9797
("rocket_auto.png", 'auto'),
9898
])
9999
def test_scale(font_awesome, image, scale):
100+
"""Test scale option"""
100101
original_file = os.path.join('files', image)
101102

102103
font_awesome.export_icon(icon='rocket', size=16, scale=scale)
@@ -110,7 +111,7 @@ def test_scale(font_awesome, image, scale):
110111

111112

112113
# Teardown
113-
def teardown_module(module):
114+
def teardown_module():
114115
"""Delete exported icons directory"""
115116
if os.path.isdir('exported'):
116117
shutil.rmtree('exported')

icon_font_to_png/test/test_octicons.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
@pytest.fixture(scope='module')
1111
def octicons():
12+
"""Create a IconFont instance from Octicons files"""
1213
css_file = os.path.join('files', 'octicons.css')
1314
ttf_file = os.path.join('files', 'octicons.ttf')
14-
font = icon_font.IconFont(css_file=css_file, ttf_file=ttf_file)
15-
return font
15+
return icon_font.IconFont(css_file=css_file, ttf_file=ttf_file)
1616

1717

1818
def test_octicons_load_icons(octicons):

0 commit comments

Comments
 (0)