<s> """<STR_LIT>""" <EOL> import os <EOL> import unittest <EOL> import numpy <EOL> import cellprofiler . matlab <EOL> import cellprofiler . matlab . cputils as u <EOL> class TestUtils ( unittest . TestCase ) : <EOL> def test_02_001_EncapsulateString ( self ) : <EOL> a = u . encapsulate_string ( '<STR_LIT>' ) <EOL> self . assertTrue ( a . shape == ( <NUM_LIT:1> , ) ) <EOL> self . assertTrue ( a . dtype . kind == '<STR_LIT:S>' ) <EOL> self . assertTrue ( a [ <NUM_LIT:0> ] == '<STR_LIT>' ) <EOL> def test_02_001_EncapsulateUnicode ( self ) : <EOL> a = u . encapsulate_string ( u'<STR_LIT>' ) <EOL> self . assertTrue ( a . shape == ( <NUM_LIT:1> , ) ) <EOL> self . assertTrue ( a . dtype . kind == '<STR_LIT>' ) <EOL> self . assertTrue ( a [ <NUM_LIT:0> ] == u'<STR_LIT>' ) <EOL> def test_02_01_EncapsulateCell ( self ) : <EOL> cell = numpy . ndarray ( ( <NUM_LIT:1> , <NUM_LIT:1> ) , dtype = object ) <EOL> cell [ <NUM_LIT:0> , <NUM_LIT:0> ] = u'<STR_LIT>' <EOL> u . encapsulate_strings_in_arrays ( cell ) <EOL> self . assertTrue ( isinstance ( cell [ <NUM_LIT:0> , <NUM_LIT:0> ] , numpy . ndarray ) ) <EOL> self . assertTrue ( cell [ <NUM_LIT:0> , <NUM_LIT:0> ] [ <NUM_LIT:0> ] == u'<STR_LIT>' ) <EOL> def test_02_02_EncapsulateStruct ( self ) : <EOL> struct = numpy . ndarray ( ( <NUM_LIT:1> , <NUM_LIT:1> ) , dtype = [ ( '<STR_LIT:foo>' , object ) ] ) <EOL> struct [ '<STR_LIT:foo>' ] [ <NUM_LIT:0> , <NUM_LIT:0> ] = u'<STR_LIT>' <EOL> u . encapsulate_strings_in_arrays ( struct ) <EOL> self . assertTrue ( isinstance ( struct [ '<STR_LIT:foo>' ] [ <NUM_LIT:0> , <NUM_LIT:0> ] , numpy . ndarray ) ) <EOL> self . assertTrue ( struct [ '<STR_LIT:foo>' ] [ <NUM_LIT:0> , <NUM_LIT:0> ] [ <NUM_LIT:0> ] == u'<STR_LIT>' ) <EOL> def test_02_03_EncapsulateCellInStruct ( self ) : <EOL> struct = numpy . ndarray ( ( <NUM_LIT:1> , <NUM_LIT:1> ) , dtype = [ ( '<STR_LIT:foo>' , object ) ] ) <EOL> cell = numpy . ndarray ( ( <NUM_LIT:1> , <NUM_LIT:1> ) , dtype = object ) <EOL> cell [ <NUM_LIT:0> , <NUM_LIT:0> ] = u'<STR_LIT>' <EOL> struct [ '<STR_LIT:foo>' ] [ <NUM_LIT:0> , <NUM_LIT:0> ] = cell <EOL> u . encapsulate_strings_in_arrays ( struct ) <EOL> self . assertTrue ( isinstance ( cell [ <NUM_LIT:0> , <NUM_LIT:0> ] , numpy . ndarray ) ) <EOL> self . assertTrue ( cell [ <NUM_LIT:0> , <NUM_LIT:0> ] [ <NUM_LIT:0> ] == u'<STR_LIT>' ) <EOL> def test_02_04_EncapsulateStructInCell ( self ) : <EOL> struct = numpy . ndarray ( ( <NUM_LIT:1> , <NUM_LIT:1> ) , dtype = [ ( '<STR_LIT:foo>' , object ) ] ) <EOL> cell = numpy . ndarray ( ( <NUM_LIT:1> , <NUM_LIT:1> ) , dtype = object ) <EOL> cell [ <NUM_LIT:0> , <NUM_LIT:0> ] = struct <EOL> struct [ '<STR_LIT:foo>' ] [ <NUM_LIT:0> , <NUM_LIT:0> ] = u'<STR_LIT>' <EOL> u . encapsulate_strings_in_arrays ( cell ) <EOL> self . assertTrue ( isinstance ( struct [ '<STR_LIT:foo>' ] [ <NUM_LIT:0> , <NUM_LIT:0> ] , numpy . ndarray ) ) <EOL> self . assertTrue ( struct [ '<STR_LIT:foo>' ] [ <NUM_LIT:0> , <NUM_LIT:0> ] [ <NUM_LIT:0> ] == u'<STR_LIT>' ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
