def test_from_action(self): actions = [ 'test', 'sale', 'refund', 'balance', 'upload', 'settlement', ] bitmaps = [ '6016', '7f96', '7f96', '7e16', '7dde', '6036', ] for i, action in enumerate(actions): result = Bitmap.from_action(action) self.assertEqual(result, bitmaps[i])
def test_hexlify(self): bits = [ [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0], ] results = [ '6016', '7f96', '7f96', '7e16', '7dd6', '6036', ] for i, bitset in enumerate(bits): result = Bitmap.hexlify(bitset) self.assertEqual(result, results[i])
def test_unhexlify(self): bitmaps = [ '6016', '7f96', '7f96', '7e16', '7dd6', '6036', ] bits = [ '0110000000010110', '0111111110010110', '0111111110010110', '0111111000010110', '0111110111010110', '0110000000110110', ] for i, bitmap in enumerate(bitmaps): result = Bitmap.unhexlify(bitmap) self.assertEqual(result, bits[i])
from src.bitmap import Bitmap bitmap = Bitmap() cmd = input('Entre command \n ') # while not os.path.isfile(cmd): # cmd = input('command ? => ') cmd_list = cmd.split() cmd_name = cmd_list[0] bitmap.set_options(cmd_name, cmd_list[1:])
def test_settlement_rq(self): result = Bitmap.settlement_rq() self.assertEqual(result, '6036')
def test_upload_rq(self): result = Bitmap.upload_rq() self.assertEqual(result, '7dde')
def test_balance_rq(self): result = Bitmap.balance_rq() self.assertEqual(result, '7e16')
def test_refund_rq(self): result = Bitmap.refund_rq() self.assertEqual(result, '7f96')
def test_sale_rq(self): result = Bitmap.sale_rq() self.assertEqual(result, '7f96')
def test_test_rq(self): result = Bitmap.test_rq() self.assertEqual(result, '6016')