How to use aPRAW - 10 common examples

To help you get started, we’ve selected a few aPRAW examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Dan6erbond / aPRAW / tests / integration / models / test_listing_generator.py View on Github external
async def test_listing_generator_get(self, reddit):
        subreddit = await reddit.subreddit("aprawtest")
        listing_generator = subreddit.new

        async for submission in listing_generator.get():
            assert isinstance(submission, apraw.models.Submission)
github Dan6erbond / aPRAW / tests / integration / models / test_subreddit_wiki.py View on Github external
async def test_subreddit_wiki_revisions(self, reddit):
        subreddit = await reddit.subreddit("aprawtest")

        async for revision in subreddit.wiki.revisions():
            assert hasattr(revision, "page")
            assert isinstance(revision, apraw.models.WikipageRevision)
            assert isinstance(revision.author, apraw.models.Redditor)
github Dan6erbond / aPRAW / tests / integration / models / test_listing_generator.py View on Github external
async def test_listing_generator_stream(self, reddit):
        subreddit = await reddit.subreddit("askreddit")
        listing_generator = subreddit.new

        i = 0
        async for submission in listing_generator.stream():
            i += 1
            assert isinstance(submission, apraw.models.Submission)
            if i >= 5: break

        time_started = datetime.utcnow()

        i = 0
        async for submission in listing_generator.stream(True):
            i += 1
            assert isinstance(submission, apraw.models.Submission)
            assert submission.created_utc >= time_started
            if i >= 5: break
github Dan6erbond / aPRAW / tests / integration / models / test_subreddit.py View on Github external
async def test_subreddit_moderation_listing(self, reddit):
        subreddit = await reddit.subreddit("aprawtest")
        report = None

        async for rep in subreddit.mod.reports():
            report = rep
            break

        assert isinstance(
            report, apraw.models.submission.Submission) or isinstance(
            report, apraw.models.comment.Comment)
github Dan6erbond / aPRAW / tests / integration / models / test_subreddit_wiki.py View on Github external
async def test_subreddit_wiki_revisions(self, reddit):
        subreddit = await reddit.subreddit("aprawtest")

        async for revision in subreddit.wiki.revisions():
            assert hasattr(revision, "page")
            assert isinstance(revision, apraw.models.WikipageRevision)
            assert isinstance(revision.author, apraw.models.Redditor)
github Dan6erbond / aPRAW / tests / integration / models / test_subreddit.py View on Github external
async def test_subreddit_moderation_listing(self, reddit):
        subreddit = await reddit.subreddit("aprawtest")
        report = None

        async for rep in subreddit.mod.reports():
            report = rep
            break

        assert isinstance(
            report, apraw.models.Submission) or isinstance(
            report, apraw.models.Comment)
github Dan6erbond / aPRAW / tests.py View on Github external
async def run_tests():
    reddit = apraw.Reddit("D6B")
    i = 0
    for test in tests:
        print("{}:".format(i), test)
        i += 1

    while True:
        i = input("Select a test to run: ")
        try:
            i = int(i)
            if i >= 0 and i < len(tests):
                await tests[i](reddit)
            else:
                print("No test found at position {}!".format(i))
        except Exception as e:
            s = re.search("^(\d+)$", i)
            if s is None:
github Dan6erbond / aPRAW / tests / integration / models / test_subreddit.py View on Github external
async def test_subreddit_moderation_listing(self, reddit):
        subreddit = await reddit.subreddit("aprawtest")
        report = None

        async for rep in subreddit.mod.reports():
            report = rep
            break

        assert isinstance(
            report, apraw.models.Submission) or isinstance(
            report, apraw.models.Comment)
github Dan6erbond / aPRAW / tests / integration / models / test_subreddit.py View on Github external
async def test_subreddit_random(self, reddit):
        subreddit = await reddit.subreddit("aprawtest")
        submission = await subreddit.random()
        assert isinstance(submission, apraw.models.Submission)
github Dan6erbond / aPRAW / tests / integration / test_reddit.py View on Github external
async def test_reddit_subreddits(self, reddit: apraw.Reddit):
        subreddit = None

        async for sub in reddit.subreddits():
            subreddit = sub
            break

        assert isinstance(subreddit, apraw.models.Subreddit)