'Test automated batch creation from Purchase Receipt'

def test_purchase_receipt(self, batch_qty=100):

    self.make_batch_item(u'ITEM-BATCH-1')
    receipt = frappe.get_doc(dict(doctype=u'Purchase    Receipt', supplier=u'_Test    Supplier', items=[dict(item_code=u'ITEM-BATCH-1', qty=batch_qty, rate=10)])).insert()
    receipt.submit()
    self.assertTrue(receipt.items[0].batch_no)
    self.assertEquals(get_batch_qty(receipt.items[0].batch_no, receipt.items[0].warehouse), batch_qty)
    return receipt
