<s> from posixpath import join as pjoin <EOL> import pytest <EOL> from ibis . compat import unittest <EOL> from ibis . impala . tests . common import ImpalaE2E <EOL> from ibis . impala import madlib <EOL> import ibis . util as util <EOL> class TestMADLib ( ImpalaE2E , unittest . TestCase ) : <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> super ( TestMADLib , cls ) . setUpClass ( ) <EOL> cls . db = '<STR_LIT>' . format ( util . guid ( ) [ : <NUM_LIT:4> ] ) <EOL> cls . con . create_database ( cls . db ) <EOL> @ classmethod <EOL> def tearDownClass ( cls ) : <EOL> super ( TestMADLib , cls ) . tearDownClass ( ) <EOL> try : <EOL> cls . con . drop_database ( cls . db , force = True ) <EOL> except : <EOL> pass <EOL> def setUp ( self ) : <EOL> super ( TestMADLib , self ) . setUp ( ) <EOL> self . madlib_so = pjoin ( self . test_data_dir , '<STR_LIT>' ) <EOL> self . api = madlib . MADLibAPI ( self . madlib_so , self . db ) <EOL> @ pytest . mark . madlib <EOL> def test_create_functions ( self ) : <EOL> self . api . create_functions ( self . con ) <EOL> for name in self . api . _udfs : <EOL> func = getattr ( self . api , name ) <EOL> assert self . con . exists_udf ( func . name , database = self . db ) <EOL> for name in self . api . _udas : <EOL> func = getattr ( self . api , name ) <EOL> assert self . con . exists_uda ( func . name , database = self . db ) </s>
