Exemplo n.º 1
0
def test_string_render_args_with_custom_dt_fmt_filter_ymd():

    render_value = datetime(2018, 11, 21, 16, 30)
    result = JinjaInjector.string_render_args(
        content="yyyymm=> {{yyyymm|dt.format('%Y%m%d')}}", yyyymm=render_value)

    assert result == 'yyyymm=> 20181121'
Exemplo n.º 2
0
def test_string_render_args_with_custom_dt_add_month_filter_trace_pre_1():

    render_value = datetime(2018, 11, 21, 16, 30)
    result = JinjaInjector.string_render_args(
        content="yyyymm=> {{yyyymm|dt.add_month(format='%Y%m',trace_num=-1)}}",
        yyyymm=render_value)

    assert result == 'yyyymm=> 201810'
Exemplo n.º 3
0
 def _set_spark_session_conf(self):
     '''
         set spark session from conf/spark.conf
     '''
     logger.info('set spark configuration ...')
     self.spark_configs = get_full_keys(self.config.get("spark", None),
                                        "spark")
     for key in self.spark_configs:
         if isinstance(self.spark_configs[key], six.string_types):
             self.spark_configs[key] = JinjaInjector.string_render_args(
                 content=self.spark_configs[key], env=os.environ)
Exemplo n.º 4
0
def test_string_render_args():

    result = JinjaInjector.string_render_args(content="A=> {{A}}", A='10')

    assert result == 'A=> 10'