Пример #1
0
def test_worksheet_2() :
    #--------------------------------------------------------------------------------------
    from test_utils import adjust_environment
    global_settings = adjust_environment()

    import os
    examplesdir = global_settings.examples_dir
    filename = os.path.join(examplesdir, 'imshow.rws').decode('UTF-8')

    #--------------------------------------------------------------------------------------
    from reinteract.notebook import Notebook
    from reinteract.worksheet import Worksheet
    worksheet = Worksheet( Notebook() )
    worksheet.load(filename)
    worksheet.calculate(wait=True)

    custom_results = []
    from reinteract.chunks import StatementChunk
    from reinteract.custom_result import CustomResult
    for x in worksheet.iterate_chunks() :
        if not isinstance(x,StatementChunk) :
            continue
        if len(x.results) == 0 :
            continue
        arg = x.results[0]
        if isinstance(arg, CustomResult):
           custom_results.append(arg) 
           pass
        pass

    assert len(custom_results) == 2

    #--------------------------------------------------------------------------------------
    pass