Exemple #1
0
    def test_debug2_lib(self):
        env_var = INDRA_DEBUG2_LIB_VAR

        # Remove related environment variable for this test
        # Test the default value without any environment variable set
        os.environ.pop(env_var, None)
        self.assertFalse(Debug().debug2_lib)

        # Test debugging statement when it is set to various true values
        for value in self.true_values:
            os.environ[env_var] = value
            self.assertTrue(Debug().debug2_lib)

        # Test debugging statement when it is set to various false values
        for value in self.false_values:
            os.environ[env_var] = value
            self.assertFalse(Debug().debug2_lib)
Exemple #2
0
"""
This file contains general functions useful in trading goods.
"""
import random
import copy
# import math

from registry.registry import get_env
from lib.utils import Debug

DEBUG = Debug()

TRADE_STATUS = 0

OFFER_FROM_1 = 5
OFFER_FROM_2 = 4
INIT1 = 3
INIT2 = 2
ACCEPT = 1
INADEQ = 0
REJECT = -1
NO_TRADER = -2

AMT_AVAIL = "amt_available"
GOODS = "goods"

trade_state_dict = {
    OFFER_FROM_1: "Offer 1",
    OFFER_FROM_2: "Offer 2",
    INIT1: "Init 1",
    INIT2: "Init 2",