Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/MDAnalysis/mdanalysis in…
Browse files Browse the repository at this point in the history
…to develop
  • Loading branch information
vedantrathore committed Jan 23, 2017
2 parents ceb1618 + 9ef4a64 commit 1b04205
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
1 change: 1 addition & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Enhancements
* Added groupby method to Group objects. (PR #1112)

Fixes
* Give correct error when the topology file format is not recognized (Issue #982)
* Give correct error when file doesn't exist/ has bad permissions (Issue #981)
* Improvement of analysis/waterdynamics module (Issue #935)
* Removed MDAnalysis.analysis.PDBToBinaryTraj (Issue #1035)
Expand Down
17 changes: 8 additions & 9 deletions package/MDAnalysis/core/_get_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,13 @@ def get_parser_for(filename, format=None):
return _PARSERS[format]
except KeyError:
raise ValueError(
"Cannot autodetect topology type for file '{0}' "
"(file extension could not be parsed).\n"
" You can use 'Universe(topology, ..., topology_format=FORMAT)' "
"to explicitly specify the format and\n"
" override automatic detection. Known FORMATs are:\n"
" {1}\n"
" See http://docs.mdanalysis.org/documentation_pages/topology/init.html#supported-topology-formats\n"
" For missing formats, raise an issue at "
"http://issues.mdanalysis.org".format(filename, _PARSERS.keys()))
"'{0}' isn't a valid topology format\n"
" You can use 'Universe(topology, ..., topology_format=FORMAT)' "
" to explicitly specify the format and\n"
" override automatic detection. Known FORMATs are:\n"
" {1}\n"
" See http://docs.mdanalysis.org/documentation_pages/topology/init.html#supported-topology-formats\n"
" For missing formats, raise an issue at "
" http://issues.mdanalysis.org".format(format, _PARSERS.keys()))


13 changes: 13 additions & 0 deletions testsuite/MDAnalysisTests/core/test_universe.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ def test_Universe_no_trajectory_AE():

assert_raises(AttributeError, getattr, u, 'trajectory')

@staticmethod
def test_Universe_topology_unrecognizedformat_VE():
assert_raises(ValueError, mda.Universe, 'some.weird.not.pdb.but.converted.xtc')

@staticmethod
def test_Universe_topology_unrecognizedformat_VE_msg():
try:
mda.Universe('some.weird.not.pdb.but.converted.xtc')
except ValueError as e:
assert_('isn\'t a valid topology format' in e.args[0])
else:
raise AssertionError

@staticmethod
def test_Universe_topology_IE():
assert_raises(IOError,
Expand Down

0 comments on commit 1b04205

Please sign in to comment.