<s> from __future__ import absolute_import <EOL> import unittest <EOL> from bokeh . util . serialization import make_id , traverse_data <EOL> class DummyRequestCallable ( ) : <EOL> def json ( self ) : <EOL> return True <EOL> class DummyRequestProperty ( ) : <EOL> json = True <EOL> class TestMakeId ( unittest . TestCase ) : <EOL> def test_basic ( self ) : <EOL> self . assertEqual ( len ( make_id ( ) ) , <NUM_LIT> ) <EOL> self . assertTrue ( isinstance ( make_id ( ) , str ) ) <EOL> def test_simple_ids ( self ) : <EOL> import os <EOL> os . environ [ "<STR_LIT>" ] = "<STR_LIT:yes>" <EOL> self . assertEqual ( make_id ( ) , "<STR_LIT>" ) <EOL> self . assertEqual ( make_id ( ) , "<STR_LIT>" ) <EOL> del os . environ [ "<STR_LIT>" ] <EOL> class TestTraverseData ( unittest . TestCase ) : <EOL> testing = [ [ float ( '<STR_LIT>' ) , <NUM_LIT:3> ] , [ float ( '<STR_LIT>' ) , [ float ( '<STR_LIT>' ) ] ] ] <EOL> expected = [ [ '<STR_LIT>' , <NUM_LIT> ] , [ '<STR_LIT>' , [ '<STR_LIT>' ] ] ] <EOL> def test_return_valid_json ( self ) : <EOL> self . assertTrue ( traverse_data ( self . testing ) == self . expected ) <EOL> def test_with_numpy ( self ) : <EOL> self . assertTrue ( traverse_data ( self . testing , True ) == self . expected ) <EOL> def test_without_numpy ( self ) : <EOL> self . assertTrue ( traverse_data ( self . testing , False ) == self . expected ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
