<s> from ibis . compat import unittest <EOL> from ibis . expr . tests . mocks import MockConnection <EOL> import ibis . config as config <EOL> class TestInteractiveUse ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . con = MockConnection ( ) <EOL> def test_interactive_execute_on_repr ( self ) : <EOL> table = self . con . table ( '<STR_LIT>' ) <EOL> expr = table . bigint_col . sum ( ) <EOL> with config . option_context ( '<STR_LIT>' , True ) : <EOL> repr ( expr ) <EOL> assert len ( self . con . executed_queries ) > <NUM_LIT:0> <EOL> def test_default_limit ( self ) : <EOL> table = self . con . table ( '<STR_LIT>' ) <EOL> with config . option_context ( '<STR_LIT>' , True ) : <EOL> repr ( table ) <EOL> expected = """<STR_LIT>""" . format ( config . options . sql . default_limit ) <EOL> assert self . con . executed_queries [ <NUM_LIT:0> ] == expected <EOL> def test_respect_set_limit ( self ) : <EOL> table = self . con . table ( '<STR_LIT>' ) . limit ( <NUM_LIT:10> ) <EOL> with config . option_context ( '<STR_LIT>' , True ) : <EOL> repr ( table ) <EOL> expected = """<STR_LIT>""" <EOL> assert self . con . executed_queries [ <NUM_LIT:0> ] == expected <EOL> def test_disable_query_limit ( self ) : <EOL> table = self . con . table ( '<STR_LIT>' ) <EOL> with config . option_context ( '<STR_LIT>' , True ) : <EOL> with config . option_context ( '<STR_LIT>' , None ) : <EOL> repr ( table ) <EOL> expected = """<STR_LIT>""" <EOL> assert self . con . executed_queries [ <NUM_LIT:0> ] == expected <EOL> def test_interactive_non_compilable_repr_not_fail ( self ) : <EOL> table = self . con . table ( '<STR_LIT>' ) <EOL> expr = table . string_col . topk ( <NUM_LIT:3> ) <EOL> with config . option_context ( '<STR_LIT>' , True ) : <EOL> repr ( expr ) <EOL> def test_histogram_repr_no_query_execute ( self ) : <EOL> t = self . con . table ( '<STR_LIT>' ) <EOL> tier = t . double_col . histogram ( <NUM_LIT:10> ) . name ( '<STR_LIT>' ) <EOL> expr = t . group_by ( tier ) . size ( ) <EOL> with config . option_context ( '<STR_LIT>' , True ) : <EOL> expr . _repr ( ) <EOL> assert self . con . executed_queries == [ ] <EOL> def test_compile_no_execute ( self ) : <EOL> t = self . con . table ( '<STR_LIT>' ) <EOL> t . double_col . sum ( ) . compile ( ) <EOL> assert self . con . executed_queries == [ ] </s>
