Exemplo n.º 1
0
 def test_all_bridges_random_three(self):
     ids = random.sample(range(1, 2782), 3)
     bridge_copy = copy.deepcopy(BRIDGE_FORMATTED_BACK_UP)
     for bridge_id in ids:
         bf.add_rehab(bridge_copy, bridge_id, "12/20/2018", True)
     expect = 3
     acc = 0
     for bridge in bridge_copy:
         if bridge[bf.LAST_MAJOR_INDEX] == "12/20/2018":
             acc += 1
     self.assertEqual(expect, acc)
Exemplo n.º 2
0
 def test_last_fifty_random_three(self):
     ids = random.sample(range(2732, 2782), 3)
     bridge_copy = copy.deepcopy(BRIDGE_FORMATTED_BACK_UP)
     for bridge_id in ids:
         bf.add_rehab(bridge_copy, bridge_id, "12/20/2018", False)
     expect = 3
     acc = 0
     for i in range(2732, 2782):
         bridge = bf.get_bridge(bridge_copy, i)
         if bridge[bf.LAST_MINOR_INDEX] == "12/20/2018" and i in ids:
             acc += 1
     self.assertEqual(expect, acc)
Exemplo n.º 3
0
 def test_all_bridges_false(self):
     ids = []
     for i in range(1, 2782):
         ids.append(i)
     bridge_copy = copy.deepcopy(BRIDGE_FORMATTED_BACK_UP)
     for bridge_id in ids:
         bf.add_rehab(bridge_copy, bridge_id, "12/20/2018", False)
     expect = 2781
     acc = 0
     for bridge in bridge_copy:
         if bridge[bf.LAST_MINOR_INDEX] == "12/20/2018":
             acc += 1
     self.assertEqual(expect, acc)
Exemplo n.º 4
0
    lst[9] = lst[9][:]
    lst[12] = lst[12][:]

result = bf.inspect_bridges(sample, [1, 2], "01/01/2001", 50)
assert isinstance(result, type(None)), \
    '''bridge_functions.inspect_bridges should return None'''
our_print('  check complete')

#Type and simple check bridge_functions.add_rehab
our_print('Checking add_rehab...')
sample = [inner[:] for inner in sample_bridges]
for lst in sample:
    lst[9] = lst[9][:]
    lst[12] = lst[12][:]

result = bf.add_rehab(sample, 2, "01/01/2001", True)
assert isinstance(result, type(None)), \
    '''bridge_functions.add_rehab should return None'''
our_print('  check complete')

builtins.print = our_print
builtins.input = our_input

print(
    "================= End: checking parameter and return types =================\n"
)

print('========== Start: checking whether constants are unchanged ==========')

# Get the final values of the constants
CONSTS_AFTER = [