Repository: seperman/deepdiff

Issue:
DeepSearch doesn't search for inherited class attributes
```python
class Foo(object):
    bar = 'baz'

deepdiff.DeepSearch(Foo, 'baz')
#-> {}
```

The solution to this looks pretty simple: in `DeepSearch.__search_obj()`, change [this line](https://github.com/seperman/deepdiff/blob/master/deepdiff/search.py#L134) to `obj = {getattr(attr) for attr in dir(obj)}`. `dir()` traverses the inheritence tree, finding attributes not in `__dict__`. I'm happy to make a PR if this looks good to you.

Discussion:
maxrothman: Looks like I made a typo, which caused tests to fail. It should be fixed now, and when this merges, you can just use the "squash and merge" option to hide the "squash me" commit.
maxrothman: Never mind about the squashing thing, I handled it myself. Just getting this to pass tests now.
coveralls: 
[![Coverage Status](https://:/builds/12038008/badge)](https://:/builds/12038008)

Coverage remained the same at 100.0% when pulling **f87c032ab810fa719e2625ba96e61913a9585565 on maxrothman:patch-1** into **0d11d0874ca6c540d86c7429f9072d774f7b4a94 on seperman:master**.

coveralls: 
[![Coverage Status](https://:/builds/12038178/badge)](https://:/builds/12038178)

Coverage remained the same at 100.0% when pulling **b794c87090b0e63ef97b10cdd090697316e4b934 on maxrothman:patch-1** into **0d11d0874ca6c540d86c7429f9072d774f7b4a94 on seperman:master**.


Patch:
diff --git a/deepdiff/search.py b/deepdiff/search.py
index 26ba882..f9fc465 100644
--- a/deepdiff/search.py
+++ b/deepdiff/search.py
@@ -131,7 +131,10 @@ class DeepSearch(dict):
             if is_namedtuple:
                 obj = obj._asdict()
             else:
-                obj = obj.__dict__
+                # Skip magic methods. Slightly hacky, but unless people are defining
+                # new magic methods they want to search, it should work fine.
+                obj = {i: getattr(obj, i) for i in dir(obj)
+                    if not (i.startswith('__') and i.endswith('__'))}
         except AttributeError:
             try:
                 obj = {i: getattr(obj, i) for i in obj.__slots__}


Test patch:
diff --git a/tests/test_search.py b/tests/test_search.py
index 49929c6..6257875 100644
--- a/tests/test_search.py
+++ b/tests/test_search.py
@@ -286,6 +286,18 @@ class DeepSearchTestCase(unittest.TestCase):
         result = {'matched_values': {'root'}}
         self.assertEqual(DeepSearch(obj, item, verbose_level=1, case_sensitive=False), result)
 
+    def test_search_inherited_attributes(self):
+        class Parent(object):
+            a = 1
+
+        class Child(Parent):
+            b = 2
+
+        obj = Child()
+        item = 1
+        result = {'matched_values': {'root.a'}}
+        self.assertEqual(DeepSearch(obj, item, verbose_level=1), result)
+
 
 class GrepTestCase(unittest.TestCase):