Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More tests

  • Loading branch information...
commit b5d20f151363e517612e60c72dcb0f06e151a816 1 parent d8d4f6a
Clinton Ecker authored
Showing with 17 additions and 11 deletions.
  1. +17 −11 lighthouse.py
View
28 lighthouse.py
@@ -50,15 +50,11 @@ def _integer(self, data):
10
>>> lh._integer('True')
Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- File "lighthouse.py", line 48, in _integer
- return int(data,10)
+ ...
ValueError: invalid literal for int() with base 10: 'True'
>>> lh._integer('23.5')
Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- File "lighthouse.py", line 48, in _integer
- return int(data,10)
+ ...
ValueError: invalid literal for int() with base 10: '23.5'
"""""
if data:
@@ -133,15 +129,25 @@ def _get_data(self, path):
>>> lh = Lighthouse()
>>> lh._get_data('projects.xml')
- Error: Please set token and url properly
+ Error: Please set url properly
+ >>> lh.url = 'http://ars.lighthouseapp.com'
+ >>> lh._get_data('projectx.xml')
+ Traceback (most recent call last):
+ ...
+ ExpatError: mismatched tag: line 31, column 4
+ >>> lh.url = 'http://example.com'
+ >>> lh._get_data('projects.xml')
+ Traceback (most recent call last):
+ ...
+ ExpatError: mismatched tag: line 31, column 4
"""
- if self.token != None and self.url != None:
+ if self.url != None:
endpoint = os.path.join(self.url, path)
rh = urllib.urlopen(endpoint)
data = rh.read()
return self._parse_xml(data)
else:
- print "Error: Please set token and url properly"
+ print "Error: Please set url properly"
def _parse_xml(self, xmldata):
return xmltodict(xmldata)
@@ -233,5 +239,5 @@ def __init__(self, arg):
self.arg = arg
if __name__ == "__main__":
- import doctest
- doctest.testmod()
+ import doctest
+ doctest.testmod(optionflags=doctest.IGNORE_EXCEPTION_DETAIL)
Please sign in to comment.
Something went wrong with that request. Please try again.