Repository: sympy/sympy

Issue:
Bidirectional Limit not implemented
```
Limit(1/x, x, 0, dir='+-').doit()
```
is not implemented whereas
```
limit(1/x, x, 0, dir='+-')
```
is.

Discussion:

Patch:
diff --git a/sympy/series/limits.py b/sympy/series/limits.py
index 5c8c4fe34d..3a8822fe78 100644
--- a/sympy/series/limits.py
+++ b/sympy/series/limits.py
@@ -68,18 +68,7 @@ def limit(e, z, z0, dir="+"):
      limit_seq : returns the limit of a sequence.
     """
 
-    if dir == "+-":
-        llim = Limit(e, z, z0, dir="-").doit(deep=False)
-        rlim = Limit(e, z, z0, dir="+").doit(deep=False)
-        if llim == rlim:
-            return rlim
-        else:
-            # TODO: choose a better error?
-            raise ValueError("The limit does not exist since "
-                    "left hand limit = %s and right hand limit = %s"
-                    % (llim, rlim))
-    else:
-        return Limit(e, z, z0, dir).doit(deep=False)
+    return Limit(e, z, z0, dir).doit(deep=False)
 
 
 def heuristics(e, z, z0, dir):
@@ -259,11 +248,23 @@ def doit(self, **hints):
         if e.is_Order:
             return Order(limit(e.expr, z, z0), *e.args[1:])
 
+        l = None
+
         try:
-            r = gruntz(e, z, z0, dir)
-            if r is S.NaN:
+            if str(dir) == '+-':
+                r = gruntz(e, z, z0, '+')
+                l = gruntz(e, z, z0, '-')
+                if l != r:
+                    raise ValueError("The limit does not exist since "
+                            "left hand limit = %s and right hand limit = %s"
+                            % (l, r))
+            else:
+                r = gruntz(e, z, z0, dir)
+            if r is S.NaN or l is S.NaN:
                 raise PoleError()
         except (PoleError, ValueError):
+            if l is not None:
+                raise
             r = heuristics(e, z, z0, dir)
             if r is None:
                 return self


Test patch:
diff --git a/sympy/series/tests/test_limits.py b/sympy/series/tests/test_limits.py
index fd45eb73cf..91eea42005 100644
--- a/sympy/series/tests/test_limits.py
+++ b/sympy/series/tests/test_limits.py
@@ -551,3 +551,10 @@ def test_issue_13575():
 
     assert abs(re) < 1e-12
     assert abs(im - 1.08633774961570) < 1e-12
+
+
+def test_issue_17325():
+    assert Limit(sin(x)/x, x, 0, dir="+-").doit() == 1
+    assert Limit(x**2, x, 0, dir="+-").doit() == 0
+    assert Limit(1/x**2, x, 0, dir="+-").doit() == oo
+    raises(ValueError, lambda: Limit(1/x, x, 0, dir="+-").doit())