Repository: PyGithub/PyGithub

Issue:
Add support for listing child teams
There is currently no way to retrieve a list of child teams (nested teams). 

This is possible to do in the REST API and in go-github. https://github.com/google/go-github/blob/40fcc261cf8cf4e4fb03b63f8fbfa13949119590/github/teams.go#L222

**Sources**
- https://developer.github.com/enterprise/2.17/v3/teams/#list-child-teams
- https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/about-teams#nested-teams




Discussion:

Resolving patch:
diff --git a/github/Team.py b/github/Team.py
--- a/github/Team.py
+++ b/github/Team.py
@@ -155,6 +155,14 @@ def privacy(self):
         self._completeIfNotSet(self._privacy)
         return self._privacy.value
 
+    @property
+    def parent(self):
+        """
+        :type: string
+        """
+        self._completeIfNotSet(self._parent)
+        return self._parent.value
+
     def add_to_members(self, member):
         """
         This API call is deprecated. Use `add_membership` instead.
@@ -263,6 +271,18 @@ def edit(
         )
         self._useAttributes(data)
 
+    def get_teams(self):
+        """
+        :calls: `GET /teams/:id/teams <https://developer.github.com/v3/teams/#list-child-teams>`_
+        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Team.Team`
+        """
+        return github.PaginatedList.PaginatedList(
+            github.Team.Team,
+            self._requester,
+            self.url + '/teams',
+            None,
+        )
+
     def get_discussions(self):
         """
         :calls: `GET /teams/:id/discussions <https://developer.github.com/v3/teams/discussions/#list-discussions>`_
@@ -393,6 +413,7 @@ def _initAttributes(self):
         self._url = github.GithubObject.NotSet
         self._organization = github.GithubObject.NotSet
         self._privacy = github.GithubObject.NotSet
+        self._parent = github.GithubObject.NotSet
 
     def _useAttributes(self, attributes):
         if "id" in attributes:  # pragma no branch
@@ -423,3 +444,7 @@ def _useAttributes(self, attributes):
             )
         if "privacy" in attributes:  # pragma no branch
             self._privacy = self._makeStringAttribute(attributes["privacy"])
+        if "parent" in attributes:  # pragma no branch
+            self._parent = self._makeClassAttribute(
+                github.Team.Team, attributes["parent"]
+            )


Test patch:
diff --git a/tests/ReplayData/Team.testGetTeams.txt b/tests/ReplayData/Team.testGetTeams.txt
new file mode 100644
--- /dev/null
+++ b/tests/ReplayData/Team.testGetTeams.txt
@@ -0,0 +1,11 @@
+https
+GET
+api.github.com
+None
+/teams/189850/teams
+{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
+None
+200
+[('status', '200 OK'), ('x-ratelimit-remaining', '4973'), ('content-length', '150'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"43d7c883d1cb7d50a08d2c189550023c"'), ('date', 'Sun, 27 May 2012 05:13:46 GMT'), ('content-type', 'application/json; charset=utf-8')]
+[{"name":"DummyTeam1","id":189851,"parent":{"name":"Team created by PyGithub","id":189850}},{"name":"DummyTeam2","id":189852,"parent":{"name":"Team created by PyGithub","id":189850}},{"name":"DummyTeam3","id":189853,"parent":{"name":"Team created by PyGithub","id":189850}}]
+
diff --git a/tests/Team.py b/tests/Team.py
--- a/tests/Team.py
+++ b/tests/Team.py
@@ -55,6 +55,7 @@ def testAttributes(self):
         self.assertEqual(self.team.url, "https://api.github.com/teams/189850")
         self.assertEqual(self.team.organization, self.org)
         self.assertEqual(self.team.privacy, "closed")
+        self.assertEqual(self.team.parent, None)
 
         # test __repr__() based on this attributes
         self.assertEqual(
@@ -138,5 +139,16 @@ def testEditWithAllArguments(self):
         self.assertEqual(self.team.permission, "admin")
         self.assertEqual(self.team.privacy, "secret")
 
+    def testGetTeams(self):
+        nested_teams = self.team.get_teams()
+        self.assertListKeyEqual(
+            nested_teams,
+            lambda t: t.name,
+            ['DummyTeam1', 'DummyTeam2', 'DummyTeam3']
+        )
+        parent = nested_teams[0].parent
+        self.assertEqual(self.team.name, parent.name)
+        self.assertEqual(self.team.id, parent.id)
+
     def testDelete(self):
         self.team.delete()