Skip to content

Commit

Permalink
Merge pull request #1097 from lrnzcig/develop
Browse files Browse the repository at this point in the history
failing tests for python2.6
  • Loading branch information
stevenbird committed Aug 25, 2015
2 parents 90294b4 + d589ecd commit c5fafd8
Showing 1 changed file with 32 additions and 16 deletions.
48 changes: 32 additions & 16 deletions nltk/test/unit/test_twitter_auth.py
Expand Up @@ -32,10 +32,14 @@ def test_empty_subdir1(self):
"""
try:
self.auth.load_creds(subdir='')
# raises ValueError (zero length field name in format) for python 2.6
# OSError for the rest
except OSError:
pass
except e:
self.fail('Unexpected exception thrown:', e)
except ValueError:
pass
except Exception as e:
self.fail('Unexpected exception thrown: %s' % e)
else:
self.fail('OSError exception not thrown.')

Expand All @@ -49,8 +53,8 @@ def test_empty_subdir2(self):
self.auth.load_creds()
except ValueError:
pass
except e:
self.fail('Unexpected exception thrown:', e)
except Exception as e:
self.fail('Unexpected exception thrown: %s' % e)
else:
self.fail('ValueError exception not thrown.')

Expand All @@ -60,10 +64,14 @@ def test_missingdir(self):
"""
try:
self.auth.load_creds(subdir='/nosuchdir')
# raises ValueError (zero length field name in format) for python 2.6
# OSError for the rest
except OSError:
pass
except e:
self.fail('Unexpected exception thrown:', e)
except ValueError:
pass
except Exception as e:
self.fail('Unexpected exception thrown: %s' % e)
else:
self.fail('OSError exception not thrown.')

Expand All @@ -75,10 +83,14 @@ def test_missingfile1(self):
"""
try:
self.auth.load_creds()
# raises ValueError (zero length field name in format) for python 2.6
# OSError for the rest
except OSError:
pass
except e:
self.fail('Unexpected exception thrown:', e)
except ValueError:
pass
except Exception as e:
self.fail('Unexpected exception thrown: %s' % e)
else:
self.fail('OSError exception not thrown.')

Expand All @@ -89,10 +101,14 @@ def test_missingfile2(self):
"""
try:
self.auth.load_creds(creds_file='foobar')
# raises ValueError (zero length field name in format) for python 2.6
# OSError for the rest
except OSError:
pass
except e:
self.fail('Unexpected exception thrown:', e)
except ValueError:
pass
except Exception as e:
self.fail('Unexpected exception thrown: %s' % e)
else:
self.fail('OSError exception not thrown.')

Expand All @@ -107,8 +123,8 @@ def test_incomplete_file(self):
subdir=self.subdir)
except ValueError:
pass
except e:
self.fail('Unexpected exception thrown:', e)
except Exception as e:
self.fail('Unexpected exception thrown: %s' % e)
else:
self.fail('ValueError exception not thrown.')

Expand All @@ -122,8 +138,8 @@ def test_malformed_file1(self):
subdir=self.subdir)
except ValueError:
pass
except e:
self.fail('Unexpected exception thrown:', e)
except Exception as e:
self.fail('Unexpected exception thrown: %s' % e)
else:
self.fail('ValueError exception not thrown.')

Expand All @@ -136,8 +152,8 @@ def test_malformed_file2(self):
subdir=self.subdir)
except ValueError:
pass
except e:
self.fail('Unexpected exception thrown:', e)
except Exception as e:
self.fail('Unexpected exception thrown: %s' % e)
else:
self.fail('ValueError exception not thrown.')

Expand Down

0 comments on commit c5fafd8

Please sign in to comment.