Skip to content

Commit

Permalink
Add tests for get_pypi_packages
Browse files Browse the repository at this point in the history
  • Loading branch information
treyhunner committed Apr 4, 2014
1 parent de6312f commit cdb57e2
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion test_pep438.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from clint.textui import core
from pep438 import __version__
from pep438.main import main
from pep438.core import get_urls
from pep438.core import get_urls, get_pypi_packages


class patch_io(object):
Expand Down Expand Up @@ -101,6 +101,27 @@ def test_wrong_rel(self, get):
self.assertEqual(get_urls('package'), set([]))


class TestGetPyPIPackages(unittest.TestCase):

def test_with_version(self):
f = StringIO()
f.write('Django==1.4.5')
f.seek(0)
self.assertEqual(get_pypi_packages(f), ['Django'])

def test_no_version(self):
f = StringIO()
f.write('Django')
f.seek(0)
self.assertEqual(get_pypi_packages(f), ['Django'])

def test_url(self):
f = StringIO()
f.write('https://github.com/django/django/archive/master.zip')
f.seek(0)
self.assertEqual(get_pypi_packages(f), [])


class CommandLineTests(unittest.TestCase):

def setUp(self):
Expand Down

0 comments on commit cdb57e2

Please sign in to comment.