<s> from __future__ import absolute_import , print_function <EOL> import unittest <EOL> import bokeh . document as document <EOL> from bokeh . model import Model <EOL> from bokeh . core . properties import Int , Instance <EOL> from bokeh . server . protocol import Protocol <EOL> class AnotherModelInTestPullDoc ( Model ) : <EOL> bar = Int ( <NUM_LIT:1> ) <EOL> class SomeModelInTestPullDoc ( Model ) : <EOL> foo = Int ( <NUM_LIT:2> ) <EOL> child = Instance ( Model ) <EOL> class TestPullDocument ( unittest . TestCase ) : <EOL> def _sample_doc ( self ) : <EOL> doc = document . Document ( ) <EOL> another = AnotherModelInTestPullDoc ( ) <EOL> doc . add_root ( SomeModelInTestPullDoc ( child = another ) ) <EOL> doc . add_root ( SomeModelInTestPullDoc ( ) ) <EOL> return doc <EOL> def test_create_req ( self ) : <EOL> Protocol ( "<STR_LIT:1.0>" ) . create ( "<STR_LIT>" ) <EOL> def test_create_reply ( self ) : <EOL> sample = self . _sample_doc ( ) <EOL> Protocol ( "<STR_LIT:1.0>" ) . create ( "<STR_LIT>" , '<STR_LIT>' , sample ) <EOL> def test_create_reply_then_parse ( self ) : <EOL> sample = self . _sample_doc ( ) <EOL> msg = Protocol ( "<STR_LIT:1.0>" ) . create ( "<STR_LIT>" , '<STR_LIT>' , sample ) <EOL> copy = document . Document ( ) <EOL> msg . push_to_document ( copy ) <EOL> assert len ( sample . roots ) == <NUM_LIT:2> <EOL> assert len ( copy . roots ) == <NUM_LIT:2> </s>
