<s> from django . test import SimpleTestCase <EOL> from corehq . apps . userreports . sql import get_table_name , get_column_name <EOL> from corehq . apps . userreports . sql . util import truncate_value <EOL> class UtilitiesTestCase ( SimpleTestCase ) : <EOL> def test_truncate_value_left ( self ) : <EOL> value = '<STR_LIT>' <EOL> truncated = truncate_value ( value , max_length = len ( value ) - <NUM_LIT:1> ) <EOL> self . assertEqual ( truncated , '<STR_LIT>' ) <EOL> def test_truncate_value_right ( self ) : <EOL> value = '<STR_LIT>' <EOL> truncated = truncate_value ( value , max_length = len ( value ) - <NUM_LIT:1> , from_left = False ) <EOL> self . assertEqual ( truncated , '<STR_LIT>' ) <EOL> def test_table_name ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' , get_table_name ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def test_table_trickery ( self ) : <EOL> tricky_one = get_table_name ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> tricky_two = get_table_name ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertNotEqual ( tricky_one , tricky_two ) <EOL> def test_long_table_name ( self ) : <EOL> name = get_table_name ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> name_expected = '<STR_LIT>' <EOL> self . assertEqual ( name , name_expected ) <EOL> def test_column_trickery ( self ) : <EOL> real = get_column_name ( "<STR_LIT>" ) <EOL> trap1 = get_column_name ( "<STR_LIT>" ) <EOL> trap2 = get_column_name ( "<STR_LIT>" ) <EOL> trap3 = get_column_name ( "<STR_LIT>" ) <EOL> trap4 = get_column_name ( "<STR_LIT>" ) <EOL> trap4_expected = '<STR_LIT>' <EOL> self . assertNotEqual ( real , trap1 ) <EOL> self . assertNotEqual ( real , trap2 ) <EOL> self . assertNotEqual ( real , trap3 ) <EOL> self . assertEqual ( trap4 , trap4_expected ) </s>
