Exemplo n.º 1
0
def test_autoclip_no_room(output=True):
    config = Config()
    # config.debug_level = 9
    config.max_depth = 2
    config.string_break_width = 1
    config.string_break_method = C._STRING_BREAK_BY_WIDTH
    return pp(autoclip_no_room, output, config=config)
Exemplo n.º 2
0
def test_autoclip_no_room(output=True):
    config = Config()
    # config.debug_level = 9
    config.max_depth = 2
    config.string_break_width = 1
    config.string_break_method = C._STRING_BREAK_BY_WIDTH
    return pp(autoclip_no_room, output, config=config)
Exemplo n.º 3
0
    def test_out_of_range_in_dict(self):
        config = Config()
        config.max_depth = 1

        ans = ""
        rel_path = 'data/out_of_range_in_dict.txt'
        data_path = os.path.join(CUR_SCRIPT_PATH, rel_path)
        with codecs.open(data_path, encoding='utf8') as fp:
            ans = fp.read()
        # delete object id, such as
        # <definition.NormalClassOldStyle object at 0x7f2d9a61bac8>
        ans, _ = re.subn("at 0x[\d\w]+", "", ans)

        res = pp(df.out_of_range_in_dict, output=False, config=config)
        # delete object id, such as
        # <definition.NormalClassOldStyle object at 0x7f2d9a61bac8>
        res, _ = re.subn("at 0x[\d\w]+", "", res)
        
        self.assertEqual(res, ans)
Exemplo n.º 4
0
    def test_out_of_range_in_dict(self):
        config = Config()
        config.max_depth = 1

        ans = ""
        rel_path = 'data/out_of_range_in_dict.txt'
        data_path = os.path.join(CUR_SCRIPT_PATH, rel_path)
        with codecs.open(data_path, encoding='utf8') as fp:
            ans = fp.read()
        # delete object id, such as
        # <definition.NormalClassOldStyle object at 0x7f2d9a61bac8>
        ans, _ = re.subn("at 0x[\d\w]+", "", ans)

        res = pp(df.out_of_range_in_dict, output=False, config=config)
        # delete object id, such as
        # <definition.NormalClassOldStyle object at 0x7f2d9a61bac8>
        res, _ = re.subn("at 0x[\d\w]+", "", res)
        
        self.assertEqual(res, ans)
Exemplo n.º 5
0
def test_inline_repr_out_of_range(output=True):
    config = Config()
    config.max_depth = 1
    config.string_break_method = C._STRING_BREAK_BY_WIDTH
    config.string_break_width = 40
    return pp(inline_repr, output, config=config)
Exemplo n.º 6
0
def test_out_of_range_in_dict(output=True):
    config = Config()
    config.max_depth = 1
    return pp(out_of_range_in_dict, output, config=config)
Exemplo n.º 7
0
def test_inline_repr_out_of_range(output=True):
    config = Config()
    config.max_depth = 1
    config.string_break_method = C._STRING_BREAK_BY_WIDTH
    config.string_break_width = 40
    return pp(inline_repr, output, config=config)
Exemplo n.º 8
0
HALF_SLEEP      = DEFAULT_SLEEP * 0.5
LONGER_SLEEP    = DEFAULT_SLEEP * 1.5
DOUBLE_SLEEP    = DEFAULT_SLEEP * 2

TRUSTAS_NETWORK = E2E_CONFIG['trustas-network']
CC_PATH         = 'github.com/trustas_cc'
CC_NAME         = 'trustas_cc'
CC_VERSION      = '1.0'

logger = logging.getLogger(__name__)

# ----------

# beeprint config
pp_conf = Config()
pp_conf.max_depth = 20
pp_conf.text_autoclip_maxline = 50

# ----------

def global_config():
    """Get configuration from environment variables"""

    global DEFAULT_SLEEP
    global KEEP_NETWORK
    global WIPE_ALL
    global LOCAL_DEPLOY

    if "DEFAULT_SLEEP" in os.environ:
        DEFAULT_SLEEP = int(os.environ["DEFAULT_SLEEP"])
    if "KEEP_NETWORK" in os.environ: