`.descendants()` failed with master-part tables where the descendants only contain the part-table
## Bug Report

### Description
`table.descendants()` failed for the case where there are master-part tables downstream, where only the part-table is a descendant, but not the master.

### Reproducibility
Include:
- OS (WIN)
- Python 3.7
- MySQL Version 5.7
- MySQL Deployment Strategy (local-native)
- DataJoint Version 0.13.2

#### Reproducible case

Given the following schema design

```python
import datajoint as dj
schema = dj.Schema('test')

@schema
class A(dj.Manual):
    definition = """
    a: int
    """


@schema
class B(dj.Manual):
    definition = """
    -> A
    b: int
    """


@schema
class Master(dj.Manual):
    definition = """
    table_master: int
    """

    class Part(dj.Part):
        definition = """
        -> master
        -> B
        """
```

calling `A.descendants()` will result in the error below:

```
Traceback (most recent call last):
  File "C:\Users\thinh\Documents\TN-Vathes\MAP\map-ephys\venv\lib\site-packages\IPython\core\interactiveshell.py", line 3343, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-3-a68a3ab7b68c>", line 1, in <module>
    TableA.descendants()
  File "C:\Users\thinh\Documents\TN-Vathes\MAP\map-ephys\venv\lib\site-packages\datajoint\table.py", line 181, in descendants
    for node in self.connection.dependencies.descendants(self.full_table_name) if not node.isdigit()]
  File "C:\Users\thinh\Documents\TN-Vathes\MAP\map-ephys\venv\lib\site-packages\datajoint\dependencies.py", line 149, in descendants
    nx.algorithms.dag.topological_sort(nodes)))
  File "C:\Users\thinh\Documents\TN-Vathes\MAP\map-ephys\venv\lib\site-packages\datajoint\dependencies.py", line 30, in unite_master_parts
    raise DataJointError("Found a part table {name} without its master table.".format(name=name))
datajoint.errors.DataJointError: Found a part table `test`.`master_table__part_table` without its master table.
```
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fc69a0ae..9eda5dd0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,7 @@
 ## Release notes
 
 ### 0.13.3 -- TBD
+* Bugfix - Fix error in listing ancestors, descendants with part tables.
 * Bugfix - Fix Python 3.10 compatibility (#983) PR #972
 * Bugfix - Allow renaming non-conforming attributes in proj (#982) PR #972
 * Add - Expose proxy feature for S3 external stores (#961) PR #962
diff --git a/datajoint/dependencies.py b/datajoint/dependencies.py
index c1a331b7..cba4ee8e 100644
--- a/datajoint/dependencies.py
+++ b/datajoint/dependencies.py
@@ -18,7 +18,7 @@ def unite_master_parts(lst):
     """
     for i in range(2, len(lst)):
         name = lst[i]
-        match = re.match(r'(?P<master>`\w+`.`\w+)__\w+`', name)
+        match = re.match(r'(?P<master>`\w+`.`#?\w+)__\w+`', name)
         if match:  # name is a part table
             master = match.group('master')
             for j in range(i-1, -1, -1):
diff --git a/docs-parts/intro/Releases_lang1.rst b/docs-parts/intro/Releases_lang1.rst
index 95abc72b..d4ea88ae 100644
--- a/docs-parts/intro/Releases_lang1.rst
+++ b/docs-parts/intro/Releases_lang1.rst
@@ -1,5 +1,6 @@
 0.13.3 -- TBD
 ----------------------
+* Bugfix - Fix error in listing ancestors, descendants with part tables.
 * Bugfix - Fix Python 3.10 compatibility (#983) PR #972
 * Bugfix - Allow renaming non-conforming attributes in proj (#982) PR #972
 * Add - Expose proxy feature for S3 external stores (#961) PR #962
diff --git a/tests/test_dependencies.py b/tests/test_dependencies.py
index 2b7687bb..de9b1360 100644
--- a/tests/test_dependencies.py
+++ b/tests/test_dependencies.py
@@ -9,13 +9,17 @@ def test_unite_master_parts():
         ['`s`.`a`', '`s`.`a__q`', '`s`.`a__r`', '`s`.`b`', '`s`.`b__q`', '`s`.`c`', '`s`.`c__q`', '`s`.`d`'])
     assert_list_equal(unite_master_parts(
         [
+            '`lab`.`#equipment`',
             '`cells`.`cell_analysis_method`',
             '`cells`.`cell_analysis_method_task_type`',
             '`cells`.`cell_analysis_method_users`',
             '`cells`.`favorite_selection`',
             '`cells`.`cell_analysis_method__cell_selection_params`',
+            '`lab`.`#equipment__config`',
             '`cells`.`cell_analysis_method__field_detect_params`']),
         [
+            '`lab`.`#equipment`',
+            '`lab`.`#equipment__config`',
             '`cells`.`cell_analysis_method`',
             '`cells`.`cell_analysis_method__cell_selection_params`',
             '`cells`.`cell_analysis_method__field_detect_params`',
['tests/test_dependencies.py', 'datajoint/dependencies.py', 'docs-parts/intro/Releases_lang1.rst', 'CHANGELOG.md']