def test_find_bin_by_location(): me = InventoryManager() a = Bin("A3", 12345) b = Bin("B7", 41325) assert me.find_bin_by_location("A3") == a assert me.find_bin_by_location("B7") == b
def test_find_bin_by_location(): me = InventoryManager() a = Bin("here", "adfsf", 5) b = Bin("there", "df", 2) c = Bin("not here", "boad", 54) assert me.find_bin_by_location("here") == a assert me.find_bin_by_location("there") == b
def test_add_part(): me = InventoryManager() a = Bin("A3", 12345) b = Bin("B7", 41325) me.add_part("motherboard", 1, "123l4jk", "A3") me.add_part("ssd", 1, "a21l3kj4", "B7") for part in me.parts: if part.name == "motherboard": assert part.bin_id == 0 elif part.name == "ssd": assert part.bin_id == 1
def test_add_part(): me = InventoryManager() a = Bin("here", "adfsf", 5) b = Bin("there", "df", 2) me.add_part("motherboard", 1, "here") me.add_part("ssd", 1, "there") for part in me.parts: if part.name == "motherboard": assert int(part.bin_id) == 0 elif part.name == "ssd": assert part.bin_id == 1
def test_sign_out(): me = InventoryManager() user_a = User("*****@*****.**", 12344) user_b = User("*****@*****.**", 12344) bin_a = Bin("A1", 12345) bin_b = Bin("B1", 41325) part_a = Part("motor", 2, "1j343g", bin_a.id) part_b = Part("sensor", 10, "4h935y", bin_b.id) me.sign_out(part_a, 2, user_a) assert bin_a.qty_in_bin == 0 assert len(me.logs) == 1 me.sign_out(part_b, 4, user_b) assert bin_b.qty_in_bin == 6 assert len(me.logs) == 2
def test_return_part(): me = InventoryManager() bin = Bin("C1", 123456) part = Part("wloo cs coop", 10, "kljhee", bin.id) user = User("*****@*****.**", 59487162) me.sign_out(part, 8, user) me.return_part(part, 4, user) assert bin.qty_in_bin == 6 assert len(me.logs) == 4 me.return_part(part, 2, user) assert bin.qty_in_bin == 8 assert len(me.logs) == 5
from main import Packer, Bin, Item packer = Packer() # packer.add_bin(Bin('small-envelope', 11.5, 6.125, 0.25, 10)) # packer.add_bin(Bin('large-envelope', 15.0, 12.0, 0.75, 15)) # packer.add_bin(Bin('small-box', 8.625, 5.375, 1.625, 70.0)) # packer.add_bin(Bin('medium-box', 11.0, 8.5, 5.5, 70.0)) # packer.add_bin(Bin('medium-2-box', 13.625, 11.875, 3.375, 70.0)) # packer.add_bin(Bin('large-box', 12.0, 12.0, 5.5, 70.0)) # packer.add_bin(Bin('large-2-box', 23.6875, 11.75, 3.0, 70.0)) packer.add_bin(Bin('Container01', 30, 40, 20, 100)) # packer.add_item(Item('Box01_1', 7, 8, 5, 1)) packer.add_item(Item('Box01_2', 13, 5, 10, 1)) packer.add_item(Item('Box01_2', 13, 5, 10, 1)) packer.add_item(Item('Box01_4', 5, 7, 8, 1)) packer.add_item(Item('Box01_3', 7, 8, 5, 1)) packer.add_item(Item('Box01_5', 3, 1, 5, 1)) packer.add_item(Item('Box01_6', 2, 1, 2, 1)) packer.add_item(Item('Box01_7', 2, 1, 2, 1)) packer.add_item(Item('Box01_8', 2, 1, 2, 1)) packer.add_item(Item('Box01_9', 2, 1, 2, 1)) packer.add_item(Item('Box01_10', 2, 1, 2, 1)) packer.add_item(Item('Box01_11', 2, 1, 2, 1)) packer.add_item(Item('Box01_12', 4, 8, 2, 1)) packer.add_item(Item('Box01_2', 13, 5, 10, 1)) packer.add_item(Item('Box01_2', 13, 5, 10, 1)) packer.add_item(Item('Box01_4', 5, 7, 8, 1)) packer.add_item(Item('Box01_3', 7, 8, 5, 1)) packer.add_item(Item('Box01_5', 3, 1, 5, 1))