<commit_before>import asyncio
import time
import unittest
from test_sync import setup
from pyappbase import Appbase

## this test is more of a demo of actually how the async get stream works

async def hello_world():
    while True:
        await asyncio.sleep(0.1)
        print("hello world")


class AsnycStreamTests(unittest.TestCase):

    def setUp(self):
        self.data = {
            "type": "Books",
            "id": "X2",
        }
        self.appbase = setup(Appbase)
        self.appbase.set_async()
        self.sync_appbase = setup(Appbase)

        self.sync_appbase.update({
            "type": "Books",
            "id": "X2",
            "body": {
                "department_id": 1,
                "department_name": "Books",
                "name": "A Fake Book on Network Routing",
                "price": 5295
            }
        })


    def test_stream(self):

        loop = asyncio.get_event_loop()
        loop.create_task(self.appbase.get_stream({
                "type":"Books",
                "id":"1"
            },lambda word: print(word)))

        loop.run_until_complete(hello_world())<commit_msg>making the test not run for ever<commit_after>import asyncio
import time
import unittest
from test_sync import setup
from pyappbase import Appbase

## this test is more of a demo of actually how the async get stream works

async def hello_world():
    while True:
        await asyncio.sleep(0.1)
        print("hello world")


class AsnycStreamTests(unittest.TestCase):

    def setUp(self):
        self.data = {
            "type": "Books",
            "id": "X2",
        }
        self.appbase = setup(Appbase)
        self.appbase.set_async()
        self.sync_appbase = setup(Appbase)

        self.sync_appbase.update({
            "type": "Books",
            "id": "X2",
            "body": {
                "department_id": 1,
                "department_name": "Books",
                "name": "A Fake Book on Network Routing",
                "price": 5295
            }
        })


    def test_stream(self):

        loop = asyncio.get_event_loop()
        loop.create_task(self.appbase.get_stream({
                "type":"Books",
                "id":"1"
            },lambda word: print(word)))

        loop.create_task(hello_world())
        loop.run_until_complete(asyncio.sleep(5))
{'fraction_non_alphanumeric': 0.11328790459965929, 'fraction_numerical': 0.008943781942078365, 'mean_word_length': 1.8438256658595642, 'pattern_counts': {'":': 22, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5084886', 'n_tokens_mistral': 728, 'n_tokens_neox': 681, 'n_words': 170}