Repository: praw-dev/praw

Issue:
Add a parent() method to the Message class
### Describe the solution you'd like

Just as the praw.models.Comment class has a parent() method, the praw.models.Message would have one too.
This mainly helps DRY your code as it brings Comment and Message classes a little bit closer together in terms of code syntax.


### Describe alternatives you've considered

I am currently directly calling praw message to get a new Message object, which works perfectly well but I have to pass around the `praw` object so that I can get the parent message and it looks ugly.
eg:
`self._praw.inbox.message(message_id=message.parent_id[3:])`

### Additional context

I'm willing to take on this task if it's approved.


Discussion:
I thought this already existed. I'll double check and if it doesn't exist feel free to implement.

Resolving patch:
diff --git a/praw/models/inbox.py b/praw/models/inbox.py
--- a/praw/models/inbox.py
+++ b/praw/models/inbox.py
@@ -194,11 +194,12 @@ def message(self, message_id: str) -> "praw.models.Message":
 
         """
         listing = self._reddit.get(API_PATH["message"].format(id=message_id))
-        messages = [listing[0]] + listing[0].replies
-        while messages:
-            message = messages.pop(0)
-            if message.id == message_id:
-                return message
+        messages = {
+            message.fullname: message for message in [listing[0]] + listing[0].replies
+        }
+        for fullname, message in messages.items():
+            message.parent = messages.get(message.parent_id, None)
+        return messages[f"t4_{message_id.lower()}"]
 
     def messages(
         self, **generator_kwargs: Union[str, int, Dict[str, str]]
@@ -308,7 +309,7 @@ def uncollapse(self, items: List["praw.models.Message"]):
     def unread(
         self,
         mark_read: bool = False,
-        **generator_kwargs: Union[str, int, Dict[str, str]]
+        **generator_kwargs: Union[str, int, Dict[str, str]],
     ) -> Iterator[Union["praw.models.Comment", "praw.models.Message"]]:
         """Return a :class:`.ListingGenerator` for unread comments and messages.
 
diff --git a/praw/models/reddit/message.py b/praw/models/reddit/message.py
--- a/praw/models/reddit/message.py
+++ b/praw/models/reddit/message.py
@@ -1,5 +1,5 @@
 """Provide the Message class."""
-from typing import TYPE_CHECKING, Any, Dict
+from typing import TYPE_CHECKING, Any, Dict, Optional
 
 from ...const import API_PATH
 from .base import RedditBase
@@ -70,9 +70,24 @@ def _kind(self) -> str:
         """Return the class's kind."""
         return self._reddit.config.kinds["message"]
 
+    @property
+    def parent(self) -> Optional["praw.models.Message"]:
+        """Return the parent of the message if it exists."""
+        if not self._parent and self.parent_id:
+            self._parent = self._reddit.inbox.message(self.parent_id.split("_")[1])
+        return self._parent
+
+    @parent.setter
+    def parent(self, value):
+        self._parent = value
+
     def __init__(self, reddit: "praw.Reddit", _data: Dict[str, Any]):
         """Initialize a :class:`.Message` instance."""
         super().__init__(reddit, _data=_data, _fetched=True)
+        self._parent = None
+        for reply in _data.get("replies", []):
+            if reply.parent_id == self.fullname:
+                reply.parent = self
 
     def delete(self):
         """Delete the message.


Test patch:
diff --git a/tests/integration/cassettes/TestMessage.test_parent.json b/tests/integration/cassettes/TestMessage.test_parent.json
new file mode 100644
--- /dev/null
+++ b/tests/integration/cassettes/TestMessage.test_parent.json
@@ -0,0 +1,209 @@
+{
+  "http_interactions": [
+    {
+      "recorded_at": "2022-02-19T06:44:36",
+      "request": {
+        "body": {
+          "encoding": "utf-8",
+          "string": "grant_type=password&password=<PASSWORD>&username=<USERNAME>"
+        },
+        "headers": {
+          "Accept": [
+            "*/*"
+          ],
+          "Accept-Encoding": [
+            "identity"
+          ],
+          "Authorization": [
+            "Basic <BASIC_AUTH>"
+          ],
+          "Connection": [
+            "close"
+          ],
+          "Content-Length": [
+            "74"
+          ],
+          "Content-Type": [
+            "application/x-www-form-urlencoded"
+          ],
+          "User-Agent": [
+            "<USER_AGENT> PRAW/7.5.1.dev0 prawcore/2.3.0"
+          ]
+        },
+        "method": "POST",
+        "uri": "https://www.reddit.com/api/v1/access_token"
+      },
+      "response": {
+        "body": {
+          "encoding": "UTF-8",
+          "string": "{\"access_token\": \"<ACCESS_TOKEN>\", \"token_type\": \"bearer\", \"expires_in\": 3600, \"scope\": \"*\"}"
+        },
+        "headers": {
+          "Accept-Ranges": [
+            "bytes"
+          ],
+          "Connection": [
+            "close"
+          ],
+          "Content-Length": [
+            "121"
+          ],
+          "Content-Type": [
+            "application/json; charset=UTF-8"
+          ],
+          "Date": [
+            "Sat, 19 Feb 2022 06:44:36 GMT"
+          ],
+          "Server": [
+            "snooserv"
+          ],
+          "Set-Cookie": [
+            "edgebucket=DHUvdtoe9pBhljI6ZV; Domain=reddit.com; Max-Age=63071999; Path=/;  secure"
+          ],
+          "Strict-Transport-Security": [
+            "max-age=15552000; includeSubDomains; preload"
+          ],
+          "Via": [
+            "1.1 varnish"
+          ],
+          "X-Moose": [
+            "majestic"
+          ],
+          "cache-control": [
+            "max-age=0, must-revalidate"
+          ],
+          "x-content-type-options": [
+            "nosniff"
+          ],
+          "x-frame-options": [
+            "SAMEORIGIN"
+          ],
+          "x-ratelimit-remaining": [
+            "297"
+          ],
+          "x-ratelimit-reset": [
+            "325"
+          ],
+          "x-ratelimit-used": [
+            "3"
+          ],
+          "x-xss-protection": [
+            "1; mode=block"
+          ]
+        },
+        "status": {
+          "code": 200,
+          "message": "OK"
+        },
+        "url": "https://www.reddit.com/api/v1/access_token"
+      }
+    },
+    {
+      "recorded_at": "2022-02-19T06:44:36",
+      "request": {
+        "body": {
+          "encoding": "utf-8",
+          "string": ""
+        },
+        "headers": {
+          "Accept": [
+            "*/*"
+          ],
+          "Accept-Encoding": [
+            "identity"
+          ],
+          "Authorization": [
+            "bearer <ACCESS_TOKEN>"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Cookie": [
+            "edgebucket=DHUvdtoe9pBhljI6ZV"
+          ],
+          "User-Agent": [
+            "<USER_AGENT> PRAW/7.5.1.dev0 prawcore/2.3.0"
+          ]
+        },
+        "method": "GET",
+        "uri": "https://oauth.reddit.com/message/messages/1ay4xyu/?raw_json=1"
+      },
+      "response": {
+        "body": {
+          "encoding": "UTF-8",
+          "string": "{\"kind\": \"Listing\", \"data\": {\"after\": null, \"dist\": null, \"modhash\": null, \"geo_filter\": \"\", \"children\": [{\"kind\": \"t4\", \"data\": {\"first_message\": null, \"first_message_name\": null, \"subreddit\": null, \"likes\": null, \"replies\": {\"kind\": \"Listing\", \"data\": {\"after\": null, \"dist\": null, \"modhash\": null, \"geo_filter\": \"\", \"children\": [{\"kind\": \"t4\", \"data\": {\"first_message\": 2838778686, \"first_message_name\": \"t4_1ay4vni\", \"subreddit\": null, \"likes\": null, \"replies\": \"\", \"author_fullname\": \"t2_7eoamiii\", \"id\": \"1ay4xyu\", \"subject\": \"re: main screen turn on.\", \"associated_awarding_id\": null, \"score\": 0, \"author\": \"<USERNAME>\", \"num_comments\": null, \"parent_id\": \"t4_1ay4vni\", \"subreddit_name_prefixed\": null, \"new\": false, \"type\": \"unknown\", \"body\": \"I'm still learning\", \"dest\": \"tateisukannanirase\", \"was_comment\": false, \"body_html\": \"\\u003C!-- SC_OFF --\\u003E\\u003Cdiv class=\\\"md\\\"\\u003E\\u003Cp\\u003EI\\u0026#39;m still learning\\u003C/p\\u003E\\n\\u003C/div\\u003E\\u003C!-- SC_ON --\\u003E\", \"name\": \"t4_1ay4xyu\", \"created\": 1645083674.0, \"created_utc\": 1645083674.0, \"context\": \"\", \"distinguished\": null}}, {\"kind\": \"t4\", \"data\": {\"first_message\": 2838778686, \"first_message_name\": \"t4_1ay4vni\", \"subreddit\": null, \"likes\": null, \"replies\": \"\", \"author_fullname\": \"t2_52c72tch\", \"id\": \"1ay51rz\", \"subject\": \"re: main screen turn on.\", \"associated_awarding_id\": null, \"score\": 0, \"author\": \"tateisukannanirase\", \"num_comments\": null, \"parent_id\": \"t4_1ay4xyu\", \"subreddit_name_prefixed\": null, \"new\": false, \"type\": \"unknown\", \"body\": \"all your base are belong to us!!\", \"dest\": \"<USERNAME>\", \"was_comment\": false, \"body_html\": \"\\u003C!-- SC_OFF --\\u003E\\u003Cdiv class=\\\"md\\\"\\u003E\\u003Cp\\u003Eall your base are belong to us!!\\u003C/p\\u003E\\n\\u003C/div\\u003E\\u003C!-- SC_ON --\\u003E\", \"name\": \"t4_1ay51rz\", \"created\": 1645084015.0, \"created_utc\": 1645084015.0, \"context\": \"\", \"distinguished\": null}}, {\"kind\": \"t4\", \"data\": {\"first_message\": 2838778686, \"first_message_name\": \"t4_1ay4vni\", \"subreddit\": null, \"likes\": null, \"replies\": \"\", \"author_fullname\": \"t2_7eoamiii\", \"id\": \"1ay52ry\", \"subject\": \"re: main screen turn on.\", \"associated_awarding_id\": null, \"score\": 0, \"author\": \"<USERNAME>\", \"num_comments\": null, \"parent_id\": \"t4_1ay51rz\", \"subreddit_name_prefixed\": null, \"new\": false, \"type\": \"unknown\", \"body\": \"There's no need to talk about it\", \"dest\": \"tateisukannanirase\", \"was_comment\": false, \"body_html\": \"\\u003C!-- SC_OFF --\\u003E\\u003Cdiv class=\\\"md\\\"\\u003E\\u003Cp\\u003EThere\\u0026#39;s no need to talk about it\\u003C/p\\u003E\\n\\u003C/div\\u003E\\u003C!-- SC_ON --\\u003E\", \"name\": \"t4_1ay52ry\", \"created\": 1645084168.0, \"created_utc\": 1645084168.0, \"context\": \"\", \"distinguished\": null}}], \"before\": null}}, \"author_fullname\": \"t2_52c72tch\", \"id\": \"1ay4vni\", \"subject\": \"main screen turn on.\", \"associated_awarding_id\": null, \"score\": 0, \"author\": \"tateisukannanirase\", \"num_comments\": null, \"parent_id\": null, \"subreddit_name_prefixed\": null, \"new\": false, \"type\": \"unknown\", \"body\": \"how are you gentlemen?\", \"dest\": \"<USERNAME>\", \"was_comment\": false, \"body_html\": \"\\u003C!-- SC_OFF --\\u003E\\u003Cdiv class=\\\"md\\\"\\u003E\\u003Cp\\u003Ehow are you gentlemen?\\u003C/p\\u003E\\n\\u003C/div\\u003E\\u003C!-- SC_ON --\\u003E\", \"name\": \"t4_1ay4vni\", \"created\": 1645083502.0, \"created_utc\": 1645083502.0, \"context\": \"\", \"distinguished\": null}}], \"before\": null}}"
+        },
+        "headers": {
+          "Accept-Ranges": [
+            "bytes"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Content-Length": [
+            "3392"
+          ],
+          "Content-Type": [
+            "application/json; charset=UTF-8"
+          ],
+          "Date": [
+            "Sat, 19 Feb 2022 06:44:36 GMT"
+          ],
+          "Server": [
+            "snooserv"
+          ],
+          "Set-Cookie": [
+            "loid=00000000007eoamiii.2.1595676888480.Z0FBQUFBQmlFSkhVQjI1RFNmbF9KTkVlMEhlMXktTWVwNVVDU2JBbC1BOUVhSG9jWGdtUkllNmVyaHdyVXNjbURlQ2NjWkhIa3ltMnJQTktxRTBwS0hLczVOTnFiNEJlZUdvdG9pbDU4VEd1THV6ZGZmNVlXNFdpN1pKTUtONDhHUXFkUDAxUVNrYng; Domain=reddit.com; Max-Age=63071999; Path=/; expires=Mon, 19-Feb-2024 06:44:36 GMT; secure; SameSite=None; Secure",
+            "session_tracker=qfkkkqdldjpdgjnqci.0.1645253076513.Z0FBQUFBQmlFSkhVSjNRblVtQlQ0RlUtdlkzWnRYWVB5Nk01eFJPcWtPaGdtWDFGTEZDQlE4YmVETVFRSnZCUlg1QmVjYm4wS3NYWmlkZTJTVkhWb1R0bHgxRVEzeU1zTG82dUlYajF5MUhuMFl0cnZwWDJkTHhxeVFNUWIxVTBDbC03aHMxWnNtek4; Domain=reddit.com; Max-Age=7199; Path=/; expires=Sat, 19-Feb-2022 08:44:36 GMT; secure; SameSite=None; Secure",
+            "csv=2; Max-Age=63072000; Domain=.reddit.com; Path=/; Secure; SameSite=None"
+          ],
+          "Strict-Transport-Security": [
+            "max-age=15552000; includeSubDomains; preload"
+          ],
+          "Vary": [
+            "accept-encoding"
+          ],
+          "Via": [
+            "1.1 varnish"
+          ],
+          "X-Moose": [
+            "majestic"
+          ],
+          "cache-control": [
+            "private, s-maxage=0, max-age=0, must-revalidate, no-store, max-age=0, must-revalidate"
+          ],
+          "expires": [
+            "-1"
+          ],
+          "x-content-type-options": [
+            "nosniff"
+          ],
+          "x-frame-options": [
+            "SAMEORIGIN"
+          ],
+          "x-ratelimit-remaining": [
+            "586.0"
+          ],
+          "x-ratelimit-reset": [
+            "324"
+          ],
+          "x-ratelimit-used": [
+            "14"
+          ],
+          "x-ua-compatible": [
+            "IE=edge"
+          ],
+          "x-xss-protection": [
+            "1; mode=block"
+          ]
+        },
+        "status": {
+          "code": 200,
+          "message": "OK"
+        },
+        "url": "https://oauth.reddit.com/message/messages/1ay4xyu/?raw_json=1"
+      }
+    }
+  ],
+  "recorded_with": "betamax/0.8.1"
+}
diff --git a/tests/integration/cassettes/TestMessage.test_parent__from_inbox_listing.json b/tests/integration/cassettes/TestMessage.test_parent__from_inbox_listing.json
new file mode 100644
--- /dev/null
+++ b/tests/integration/cassettes/TestMessage.test_parent__from_inbox_listing.json
@@ -0,0 +1,313 @@
+{
+  "http_interactions": [
+    {
+      "recorded_at": "2022-02-19T06:44:33",
+      "request": {
+        "body": {
+          "encoding": "utf-8",
+          "string": "grant_type=password&password=<PASSWORD>&username=<USERNAME>"
+        },
+        "headers": {
+          "Accept": [
+            "*/*"
+          ],
+          "Accept-Encoding": [
+            "identity"
+          ],
+          "Authorization": [
+            "Basic <BASIC_AUTH>"
+          ],
+          "Connection": [
+            "close"
+          ],
+          "Content-Length": [
+            "74"
+          ],
+          "Content-Type": [
+            "application/x-www-form-urlencoded"
+          ],
+          "User-Agent": [
+            "<USER_AGENT> PRAW/7.5.1.dev0 prawcore/2.3.0"
+          ]
+        },
+        "method": "POST",
+        "uri": "https://www.reddit.com/api/v1/access_token"
+      },
+      "response": {
+        "body": {
+          "encoding": "UTF-8",
+          "string": "{\"access_token\": \"<ACCESS_TOKEN>\", \"token_type\": \"bearer\", \"expires_in\": 3600, \"scope\": \"*\"}"
+        },
+        "headers": {
+          "Accept-Ranges": [
+            "bytes"
+          ],
+          "Connection": [
+            "close"
+          ],
+          "Content-Length": [
+            "121"
+          ],
+          "Content-Type": [
+            "application/json; charset=UTF-8"
+          ],
+          "Date": [
+            "Sat, 19 Feb 2022 06:44:33 GMT"
+          ],
+          "Server": [
+            "snooserv"
+          ],
+          "Set-Cookie": [
+            "edgebucket=biOpDZFDx8D9LjBuNW; Domain=reddit.com; Max-Age=63071999; Path=/;  secure"
+          ],
+          "Strict-Transport-Security": [
+            "max-age=15552000; includeSubDomains; preload"
+          ],
+          "Via": [
+            "1.1 varnish"
+          ],
+          "X-Moose": [
+            "majestic"
+          ],
+          "cache-control": [
+            "max-age=0, must-revalidate"
+          ],
+          "x-content-type-options": [
+            "nosniff"
+          ],
+          "x-frame-options": [
+            "SAMEORIGIN"
+          ],
+          "x-ratelimit-remaining": [
+            "298"
+          ],
+          "x-ratelimit-reset": [
+            "327"
+          ],
+          "x-ratelimit-used": [
+            "2"
+          ],
+          "x-xss-protection": [
+            "1; mode=block"
+          ]
+        },
+        "status": {
+          "code": 200,
+          "message": "OK"
+        },
+        "url": "https://www.reddit.com/api/v1/access_token"
+      }
+    },
+    {
+      "recorded_at": "2022-02-19T06:44:34",
+      "request": {
+        "body": {
+          "encoding": "utf-8",
+          "string": ""
+        },
+        "headers": {
+          "Accept": [
+            "*/*"
+          ],
+          "Accept-Encoding": [
+            "identity"
+          ],
+          "Authorization": [
+            "bearer <ACCESS_TOKEN>"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Cookie": [
+            "edgebucket=biOpDZFDx8D9LjBuNW"
+          ],
+          "User-Agent": [
+            "<USER_AGENT> PRAW/7.5.1.dev0 prawcore/2.3.0"
+          ]
+        },
+        "method": "GET",
+        "uri": "https://oauth.reddit.com/message/sent/?limit=1&raw_json=1"
+      },
+      "response": {
+        "body": {
+          "encoding": "UTF-8",
+          "string": "{\"kind\": \"Listing\", \"data\": {\"after\": \"t4_1ay52ry\", \"dist\": 1, \"modhash\": null, \"geo_filter\": \"\", \"children\": [{\"kind\": \"t4\", \"data\": {\"first_message\": 2838778686, \"first_message_name\": \"t4_1ay4vni\", \"subreddit\": null, \"likes\": null, \"replies\": \"\", \"author_fullname\": \"t2_7eoamiii\", \"id\": \"1ay52ry\", \"subject\": \"re: main screen turn on.\", \"associated_awarding_id\": null, \"score\": 0, \"author\": \"<USERNAME>\", \"num_comments\": null, \"parent_id\": \"t4_1ay51rz\", \"subreddit_name_prefixed\": null, \"new\": false, \"type\": \"unknown\", \"body\": \"There's no need to talk about it\", \"dest\": \"tateisukannanirase\", \"was_comment\": false, \"body_html\": \"\\u003C!-- SC_OFF --\\u003E\\u003Cdiv class=\\\"md\\\"\\u003E\\u003Cp\\u003EThere\\u0026#39;s no need to talk about it\\u003C/p\\u003E\\n\\u003C/div\\u003E\\u003C!-- SC_ON --\\u003E\", \"name\": \"t4_1ay52ry\", \"created\": 1645084168.0, \"created_utc\": 1645084168.0, \"context\": \"\", \"distinguished\": null}}], \"before\": null}}"
+        },
+        "headers": {
+          "Accept-Ranges": [
+            "bytes"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Content-Length": [
+            "938"
+          ],
+          "Content-Type": [
+            "application/json; charset=UTF-8"
+          ],
+          "Date": [
+            "Sat, 19 Feb 2022 06:44:34 GMT"
+          ],
+          "Server": [
+            "snooserv"
+          ],
+          "Set-Cookie": [
+            "loid=00000000007eoamiii.2.1595676888480.Z0FBQUFBQmlFSkhTVW1QanY3RUY0ZWc1YmFWYUcwRUg2QmF1YzgwdERKVmNTQ3I4SmpLMjg1M0RFa0JYUEhWaFh1SmkzckNYTVNfZktxalluOG4zTWlRSFZjdGMxMXdXUzd3SERyTVVJT1IxWXU0MEhUaWI1TnJtRVd5dzhYM2tMc0Q5ZVozNFNiRGM; Domain=reddit.com; Max-Age=63071999; Path=/; expires=Mon, 19-Feb-2024 06:44:34 GMT; secure; SameSite=None; Secure",
+            "session_tracker=kjeinjefqpmqbpqjnj.0.1645253074357.Z0FBQUFBQmlFSkhTQXVFTndiMVpYMTBaRlNNNTMyWWF0c1YtaUJfOWlFRnRfcllPcDdGbF81MDkyZkVZbGR2WHhHOG9UYjNaMWF3Um1OUzdtRmdkc280Y2NjckNYbl90LUlxLUZ3SW03OHlWZ3k0THdwcEFIVWxIWlZlUVNSX2FxQjRvN1VyUVVhazU; Domain=reddit.com; Max-Age=7199; Path=/; expires=Sat, 19-Feb-2022 08:44:34 GMT; secure; SameSite=None; Secure",
+            "csv=2; Max-Age=63072000; Domain=.reddit.com; Path=/; Secure; SameSite=None"
+          ],
+          "Strict-Transport-Security": [
+            "max-age=15552000; includeSubDomains; preload"
+          ],
+          "Vary": [
+            "accept-encoding"
+          ],
+          "Via": [
+            "1.1 varnish"
+          ],
+          "X-Moose": [
+            "majestic"
+          ],
+          "cache-control": [
+            "private, s-maxage=0, max-age=0, must-revalidate, no-store, max-age=0, must-revalidate"
+          ],
+          "expires": [
+            "-1"
+          ],
+          "x-content-type-options": [
+            "nosniff"
+          ],
+          "x-frame-options": [
+            "SAMEORIGIN"
+          ],
+          "x-ratelimit-remaining": [
+            "588.0"
+          ],
+          "x-ratelimit-reset": [
+            "326"
+          ],
+          "x-ratelimit-used": [
+            "12"
+          ],
+          "x-ua-compatible": [
+            "IE=edge"
+          ],
+          "x-xss-protection": [
+            "1; mode=block"
+          ]
+        },
+        "status": {
+          "code": 200,
+          "message": "OK"
+        },
+        "url": "https://oauth.reddit.com/message/sent/?limit=1&raw_json=1"
+      }
+    },
+    {
+      "recorded_at": "2022-02-19T06:44:35",
+      "request": {
+        "body": {
+          "encoding": "utf-8",
+          "string": ""
+        },
+        "headers": {
+          "Accept": [
+            "*/*"
+          ],
+          "Accept-Encoding": [
+            "identity"
+          ],
+          "Authorization": [
+            "bearer <ACCESS_TOKEN>"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Cookie": [
+            "csv=2; edgebucket=biOpDZFDx8D9LjBuNW; loid=00000000007eoamiii.2.1595676888480.Z0FBQUFBQmlFSkhTVW1QanY3RUY0ZWc1YmFWYUcwRUg2QmF1YzgwdERKVmNTQ3I4SmpLMjg1M0RFa0JYUEhWaFh1SmkzckNYTVNfZktxalluOG4zTWlRSFZjdGMxMXdXUzd3SERyTVVJT1IxWXU0MEhUaWI1TnJtRVd5dzhYM2tMc0Q5ZVozNFNiRGM; session_tracker=kjeinjefqpmqbpqjnj.0.1645253074357.Z0FBQUFBQmlFSkhTQXVFTndiMVpYMTBaRlNNNTMyWWF0c1YtaUJfOWlFRnRfcllPcDdGbF81MDkyZkVZbGR2WHhHOG9UYjNaMWF3Um1OUzdtRmdkc280Y2NjckNYbl90LUlxLUZ3SW03OHlWZ3k0THdwcEFIVWxIWlZlUVNSX2FxQjRvN1VyUVVhazU"
+          ],
+          "User-Agent": [
+            "<USER_AGENT> PRAW/7.5.1.dev0 prawcore/2.3.0"
+          ]
+        },
+        "method": "GET",
+        "uri": "https://oauth.reddit.com/message/messages/1ay51rz/?raw_json=1"
+      },
+      "response": {
+        "body": {
+          "encoding": "UTF-8",
+          "string": "{\"kind\": \"Listing\", \"data\": {\"after\": null, \"dist\": null, \"modhash\": null, \"geo_filter\": \"\", \"children\": [{\"kind\": \"t4\", \"data\": {\"first_message\": null, \"first_message_name\": null, \"subreddit\": null, \"likes\": null, \"replies\": {\"kind\": \"Listing\", \"data\": {\"after\": null, \"dist\": null, \"modhash\": null, \"geo_filter\": \"\", \"children\": [{\"kind\": \"t4\", \"data\": {\"first_message\": 2838778686, \"first_message_name\": \"t4_1ay4vni\", \"subreddit\": null, \"likes\": null, \"replies\": \"\", \"author_fullname\": \"t2_7eoamiii\", \"id\": \"1ay4xyu\", \"subject\": \"re: main screen turn on.\", \"associated_awarding_id\": null, \"score\": 0, \"author\": \"<USERNAME>\", \"num_comments\": null, \"parent_id\": \"t4_1ay4vni\", \"subreddit_name_prefixed\": null, \"new\": false, \"type\": \"unknown\", \"body\": \"I'm still learning\", \"dest\": \"tateisukannanirase\", \"was_comment\": false, \"body_html\": \"\\u003C!-- SC_OFF --\\u003E\\u003Cdiv class=\\\"md\\\"\\u003E\\u003Cp\\u003EI\\u0026#39;m still learning\\u003C/p\\u003E\\n\\u003C/div\\u003E\\u003C!-- SC_ON --\\u003E\", \"name\": \"t4_1ay4xyu\", \"created\": 1645083674.0, \"created_utc\": 1645083674.0, \"context\": \"\", \"distinguished\": null}}, {\"kind\": \"t4\", \"data\": {\"first_message\": 2838778686, \"first_message_name\": \"t4_1ay4vni\", \"subreddit\": null, \"likes\": null, \"replies\": \"\", \"author_fullname\": \"t2_52c72tch\", \"id\": \"1ay51rz\", \"subject\": \"re: main screen turn on.\", \"associated_awarding_id\": null, \"score\": 0, \"author\": \"tateisukannanirase\", \"num_comments\": null, \"parent_id\": \"t4_1ay4xyu\", \"subreddit_name_prefixed\": null, \"new\": false, \"type\": \"unknown\", \"body\": \"all your base are belong to us!!\", \"dest\": \"<USERNAME>\", \"was_comment\": false, \"body_html\": \"\\u003C!-- SC_OFF --\\u003E\\u003Cdiv class=\\\"md\\\"\\u003E\\u003Cp\\u003Eall your base are belong to us!!\\u003C/p\\u003E\\n\\u003C/div\\u003E\\u003C!-- SC_ON --\\u003E\", \"name\": \"t4_1ay51rz\", \"created\": 1645084015.0, \"created_utc\": 1645084015.0, \"context\": \"\", \"distinguished\": null}}, {\"kind\": \"t4\", \"data\": {\"first_message\": 2838778686, \"first_message_name\": \"t4_1ay4vni\", \"subreddit\": null, \"likes\": null, \"replies\": \"\", \"author_fullname\": \"t2_7eoamiii\", \"id\": \"1ay52ry\", \"subject\": \"re: main screen turn on.\", \"associated_awarding_id\": null, \"score\": 0, \"author\": \"<USERNAME>\", \"num_comments\": null, \"parent_id\": \"t4_1ay51rz\", \"subreddit_name_prefixed\": null, \"new\": false, \"type\": \"unknown\", \"body\": \"There's no need to talk about it\", \"dest\": \"tateisukannanirase\", \"was_comment\": false, \"body_html\": \"\\u003C!-- SC_OFF --\\u003E\\u003Cdiv class=\\\"md\\\"\\u003E\\u003Cp\\u003EThere\\u0026#39;s no need to talk about it\\u003C/p\\u003E\\n\\u003C/div\\u003E\\u003C!-- SC_ON --\\u003E\", \"name\": \"t4_1ay52ry\", \"created\": 1645084168.0, \"created_utc\": 1645084168.0, \"context\": \"\", \"distinguished\": null}}], \"before\": null}}, \"author_fullname\": \"t2_52c72tch\", \"id\": \"1ay4vni\", \"subject\": \"main screen turn on.\", \"associated_awarding_id\": null, \"score\": 0, \"author\": \"tateisukannanirase\", \"num_comments\": null, \"parent_id\": null, \"subreddit_name_prefixed\": null, \"new\": false, \"type\": \"unknown\", \"body\": \"how are you gentlemen?\", \"dest\": \"<USERNAME>\", \"was_comment\": false, \"body_html\": \"\\u003C!-- SC_OFF --\\u003E\\u003Cdiv class=\\\"md\\\"\\u003E\\u003Cp\\u003Ehow are you gentlemen?\\u003C/p\\u003E\\n\\u003C/div\\u003E\\u003C!-- SC_ON --\\u003E\", \"name\": \"t4_1ay4vni\", \"created\": 1645083502.0, \"created_utc\": 1645083502.0, \"context\": \"\", \"distinguished\": null}}], \"before\": null}}"
+        },
+        "headers": {
+          "Accept-Ranges": [
+            "bytes"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Content-Length": [
+            "3392"
+          ],
+          "Content-Type": [
+            "application/json; charset=UTF-8"
+          ],
+          "Date": [
+            "Sat, 19 Feb 2022 06:44:35 GMT"
+          ],
+          "Server": [
+            "snooserv"
+          ],
+          "Set-Cookie": [
+            "session_tracker=kjeinjefqpmqbpqjnj.0.1645253074837.Z0FBQUFBQmlFSkhTZUw3Mjk2cVFmOTBpNnJBOHBVU25DMzVFZlNwUC1tR0loME9jazhWMFctVGt6TlZjemU5QnRGOUZiOFNJT3M2d0otMFVDbkNPM0dEZl9YdG8tSGh0N01SbTVWNzBZUG51SjdVYmVUVElqOEhVd0MzaUZKN1IwN2FHd094c3hZb0U; Domain=reddit.com; Max-Age=7199; Path=/; expires=Sat, 19-Feb-2022 08:44:34 GMT; secure; SameSite=None; Secure"
+          ],
+          "Strict-Transport-Security": [
+            "max-age=15552000; includeSubDomains; preload"
+          ],
+          "Vary": [
+            "accept-encoding"
+          ],
+          "Via": [
+            "1.1 varnish"
+          ],
+          "X-Moose": [
+            "majestic"
+          ],
+          "cache-control": [
+            "private, s-maxage=0, max-age=0, must-revalidate, no-store, max-age=0, must-revalidate"
+          ],
+          "expires": [
+            "-1"
+          ],
+          "x-content-type-options": [
+            "nosniff"
+          ],
+          "x-frame-options": [
+            "SAMEORIGIN"
+          ],
+          "x-ratelimit-remaining": [
+            "587.0"
+          ],
+          "x-ratelimit-reset": [
+            "326"
+          ],
+          "x-ratelimit-used": [
+            "13"
+          ],
+          "x-ua-compatible": [
+            "IE=edge"
+          ],
+          "x-xss-protection": [
+            "1; mode=block"
+          ]
+        },
+        "status": {
+          "code": 200,
+          "message": "OK"
+        },
+        "url": "https://oauth.reddit.com/message/messages/1ay51rz/?raw_json=1"
+      }
+    }
+  ],
+  "recorded_with": "betamax/0.8.1"
+}
diff --git a/tests/integration/models/reddit/test_message.py b/tests/integration/models/reddit/test_message.py
--- a/tests/integration/models/reddit/test_message.py
+++ b/tests/integration/models/reddit/test_message.py
@@ -88,6 +88,22 @@ def test_message_uncollapse(self, _):
             message = next(self.reddit.inbox.messages())
             message.uncollapse()
 
+    def test_parent(self):
+        self.reddit.read_only = False
+        with self.use_cassette():
+            message = self.reddit.inbox.message("1ay4xyu")
+            parent = message.parent
+            assert isinstance(parent, Message)
+            assert parent.fullname == message.parent_id
+
+    def test_parent__from_inbox_listing(self):
+        self.reddit.read_only = False
+        with self.use_cassette():
+            message = next(self.reddit.inbox.sent(limit=1))
+            parent = message.parent
+            assert isinstance(parent, Message)
+            assert parent.fullname == message.parent_id
+
     @mock.patch("time.sleep", return_value=None)
     def test_reply(self, _):
         self.reddit.read_only = False