# Path: aetros/Trainer.py
# def is_generator(obj):
#     import inspect
# 
#     return obj is not None and (inspect.isgeneratorfunction(obj) or inspect.isgenerator(obj) or hasattr(obj, 'next') or hasattr(obj, '__next__'))


import unittest
from aetros.Trainer import is_generator


class TestIterator():

    def __iter__(self):
        return self

    def next(self):
        return ([], [])

    def __next__(self):
        return self.next()


class TestAetrosDataset(unittest.TestCase):

    def test_is_generator(self):

        gen = TestIterator()
        self.assertTrue(is_generator(gen))

        def generator():
            yield ([1, 2], [1, 2])


# Path: aetros/Trainer.py
# def is_generator(obj):
#     import inspect
# 
#     return obj is not None and (inspect.isgeneratorfunction(obj) or inspect.isgenerator(obj) or hasattr(obj, 'next') or hasattr(obj, '__next__'))


# Path: aetros/tests/aetros_dataset_test.py
import unittest
from aetros.Trainer import is_generator



class TestIterator():

    def __iter__(self):
        return self

    def next(self):
        return ([], [])

    def __next__(self):
        return self.next()


class TestAetrosDataset(unittest.TestCase):

    def test_is_generator(self):

        gen = TestIterator()
        self.assertTrue(is_generator(gen))

        def generator():
            yield ([1, 2], [1, 2])


        self.assertTrue(is_generator(generator))