Skip to content

Commit

Permalink
Don't cover error in else statement that probably cannot be reached a…
Browse files Browse the repository at this point in the history
…ny longer
  • Loading branch information
jobovy committed Sep 3, 2020
1 parent 0014088 commit 3dc26e2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions galpy/potential/verticalPotential.py
Expand Up @@ -130,7 +130,9 @@ def RZToverticalPotential(RZPot,R):
return RZPot
elif isinstance(RZPot,planarPotential):
raise PotentialError("Input to 'RZToverticalPotential' cannot be a planarPotential")
else:
else: # pragma: no cover
# All other cases should have been caught by the
# conversion.get_physical test above
raise PotentialError("Input to 'RZToverticalPotential' is neither an RZPotential-instance or a list of such instances")

def toVerticalPotential(Pot,R,phi=None,t0=0.):
Expand Down Expand Up @@ -181,7 +183,9 @@ def toVerticalPotential(Pot,R,phi=None,t0=0.):
out.append(verticalPotential(pot,R,phi=phi,t0=t0))
elif isinstance(pot,planarPotential):
raise PotentialError("Input to 'toVerticalPotential' cannot be a planarPotential")
else:
else: # pragma: no cover
# All other cases should have been caught by the
# conversion.get_physical test above
raise PotentialError("Input to 'toVerticalPotential' is neither an RZPotential-instance or a list of such instances")
return out
elif isinstance(Pot,Potential):
Expand All @@ -190,6 +194,8 @@ def toVerticalPotential(Pot,R,phi=None,t0=0.):
return Pot
elif isinstance(Pot,planarPotential):
raise PotentialError("Input to 'toVerticalPotential' cannot be a planarPotential")
else:
else: # pragma: no cover
# All other cases should have been caught by the
# conversion.get_physical test above
raise PotentialError("Input to 'toVerticalPotential' is neither an Potential-instance or a list of such instances")

0 comments on commit 3dc26e2

Please sign in to comment.