forked from kakwa/py-ascii-graph
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding the tests directory plus a simple test
adding what's needed for the tests plus one simple test and removing a useless file
- Loading branch information
Showing
5 changed files
with
69 additions
and
51 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
cd `dirname $0` | ||
python setup.py test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,58 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import sys | ||
from distutils.core import setup | ||
|
||
# I really prefer Markdown to reStructuredText. PyPi does not. This allows me | ||
# to have things how I'd like, but not throw complaints when people are trying | ||
# to install the package and they don't have pypandoc or the README in the | ||
# right place. | ||
try: | ||
import pypandoc | ||
description = pypandoc.convert('README.md', 'rst') | ||
import pypandoc | ||
description = pypandoc.convert('README.md', 'rst') | ||
except (OSError, IOError, ImportError): | ||
description = '' | ||
description = '' | ||
|
||
try: | ||
license = open('LICENSE').read() | ||
license = open('LICENSE').read() | ||
except IOError: | ||
license = 'MIT' | ||
license = 'MIT' | ||
|
||
try: | ||
from setuptools import setup | ||
from setuptools.command.test import test as TestCommand | ||
|
||
class PyTest(TestCommand): | ||
def finalize_options(self): | ||
TestCommand.finalize_options(self) | ||
self.test_args = [] | ||
self.test_suite = True | ||
|
||
def run_tests(self): | ||
#import here, cause outside the eggs aren't loaded | ||
import pytest | ||
errno = pytest.main(self.test_args) | ||
sys.exit(errno) | ||
|
||
except ImportError: | ||
|
||
from distutils.core import setup | ||
PyTest = lambda x: x | ||
|
||
|
||
setup( | ||
name = 'ascii_graph', | ||
version = '0.1.0', | ||
author = 'Pierre-Francois Carpentier', | ||
author_email = '[email protected]', | ||
packages = ['ascii_graph'], | ||
scripts = [], | ||
url = 'https://github.com/kakwa/ascii_graph', | ||
license = license, | ||
description = 'A simple python lib to print data as ascii histograms.', | ||
long_description = description, | ||
install_requires = [], | ||
name = 'ascii_graph', | ||
version = '0.1.0', | ||
author = 'Pierre-Francois Carpentier', | ||
author_email = '[email protected]', | ||
packages = ['ascii_graph'], | ||
scripts = [], | ||
url = 'https://github.com/kakwa/ascii_graph', | ||
license = license, | ||
description = 'A simple python lib to print data as ascii histograms.', | ||
long_description = description, | ||
install_requires = [], | ||
tests_require=['pytest'], | ||
cmdclass={'test': PyTest}, | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
from __future__ import with_statement | ||
import pytest | ||
|
||
from ascii_graph import Pyasciigraph | ||
|
||
class TestLib(object): | ||
|
||
def test_unsorted_default_params(self): | ||
test = [('long_label', 423), ('sl', 1234), ('line3', 531), ('line4', 200), ('line5', 834)] | ||
graph = Pyasciigraph() | ||
res = graph.graph('test print', test) | ||
expected = [ | ||
'test print', | ||
u'###############################################################################', | ||
u'████████████████████ 423 long_label', | ||
u'█████████████████████████████████████████████████████████████ 1234 sl ', | ||
u'██████████████████████████ 531 line3 ', | ||
u'█████████ 200 line4 ', | ||
u'█████████████████████████████████████████ 834 line5 ', | ||
] | ||
assert res == expected |