class TestCraftingWood(unittest.TestCase): """ Test basic crafting functionality. These tests require a "wood" recipe, which turns logs into wood. This recipe was chosen because it is the simplest and most essential recipe from which all crafting is derived. """ def setUp(self): self.i = Crafting() def test_check_crafting(self): self.i.crafting[0] = Slot(bravo.blocks.blocks["log"].slot, 0, 1) # Force crafting table to be rechecked. self.i.update_crafted() self.assertTrue(self.i.recipe) self.assertEqual(self.i.crafted[0], (bravo.blocks.blocks["wood"].slot, 0, 4)) def test_check_crafting_multiple(self): self.i.crafting[0] = Slot(bravo.blocks.blocks["log"].slot, 0, 2) # Force crafting table to be rechecked. self.i.update_crafted() # Only checking count of crafted table; the previous test assured that # the recipe was selected. self.assertEqual(self.i.crafted[0], (bravo.blocks.blocks["wood"].slot, 0, 4)) def test_check_crafting_offset(self): self.i.crafting[1] = Slot(bravo.blocks.blocks["log"].slot, 0, 1) # Force crafting table to be rechecked. self.i.update_crafted() self.assertTrue(self.i.recipe)
class TestCraftingTorches(unittest.TestCase): """ Test basic crafting functionality. Assumes that the basic torch recipe is present and enabled. This recipe was chosen because somebody was having problems crafting torches. """ def setUp(self): recipes = retrieve_plugins(IRecipe) if "torches" not in recipes: raise unittest.SkipTest("Plugin not present") self.i = Crafting() def test_check_crafting(self): self.i.crafting[0] = Slot(bravo.blocks.items["coal"].slot, 0, 1) self.i.crafting[2] = Slot(bravo.blocks.items["stick"].slot, 0, 1) # Force crafting table to be rechecked. self.i.update_crafted() self.assertTrue(self.i.recipe) self.assertEqual(self.i.recipe_offset, 0) self.assertEqual(self.i.crafted[0], (bravo.blocks.blocks["torch"].slot, 0, 4)) def test_check_crafting_multiple(self): self.i.crafting[0] = Slot(bravo.blocks.items["coal"].slot, 0, 2) self.i.crafting[2] = Slot(bravo.blocks.items["stick"].slot, 0, 2) # Force crafting table to be rechecked. self.i.update_crafted() # Only checking count of crafted table; the previous test assured that # the recipe was selected. self.assertEqual(self.i.crafted[0], (bravo.blocks.blocks["torch"].slot, 0, 4)) def test_check_crafting_offset(self): self.i.crafting[1] = Slot(bravo.blocks.items["coal"].slot, 0, 1) self.i.crafting[3] = Slot(bravo.blocks.items["stick"].slot, 0, 1) # Force crafting table to be rechecked. self.i.update_crafted() self.assertTrue(self.i.recipe) self.assertEqual(self.i.recipe_offset, 1)
class TestCraftingTorches(unittest.TestCase): """ Test basic crafting functionality. Assumes that the basic torch recipe is present and enabled. This recipe was chosen because somebody was having problems crafting torches. """ def setUp(self): recipes = retrieve_plugins(IRecipe) if "torches" not in recipes: raise unittest.SkipTest("Plugin not present") self.i = Crafting() def test_check_crafting(self): self.i.crafting[0] = Slot(bravo.blocks.items["coal"].slot, 0, 1) self.i.crafting[2] = Slot(bravo.blocks.items["stick"].slot, 0, 1) # Force crafting table to be rechecked. self.i.update_crafted() self.assertTrue(self.i.recipe) self.assertEqual(self.i.crafted[0], (bravo.blocks.blocks["torch"].slot, 0, 4)) def test_check_crafting_multiple(self): self.i.crafting[0] = Slot(bravo.blocks.items["coal"].slot, 0, 2) self.i.crafting[2] = Slot(bravo.blocks.items["stick"].slot, 0, 2) # Force crafting table to be rechecked. self.i.update_crafted() # Only checking count of crafted table; the previous test assured that # the recipe was selected. self.assertEqual(self.i.crafted[0], (bravo.blocks.blocks["torch"].slot, 0, 4)) def test_check_crafting_offset(self): self.i.crafting[1] = Slot(bravo.blocks.items["coal"].slot, 0, 1) self.i.crafting[3] = Slot(bravo.blocks.items["stick"].slot, 0, 1) # Force crafting table to be rechecked. self.i.update_crafted() self.assertTrue(self.i.recipe)
class TestCraftingSticks(unittest.TestCase): """ Test basic crafting functionality. Assumes that the basic wood->stick recipe is present and enabled. This recipe was chosen because it is the simplest recipe with more than one ingredient. """ def setUp(self): self.i = Crafting() def test_check_crafting(self): self.i.crafting[0] = Slot(bravo.blocks.blocks["wood"].slot, 0, 1) self.i.crafting[2] = Slot(bravo.blocks.blocks["wood"].slot, 0, 1) # Force crafting table to be rechecked. self.i.update_crafted() self.assertTrue(self.i.recipe) self.assertEqual(self.i.recipe_offset, 0) self.assertEqual(self.i.crafted[0], (bravo.blocks.items["stick"].slot, 0, 4)) def test_check_crafting_multiple(self): self.i.crafting[0] = Slot(bravo.blocks.blocks["wood"].slot, 0, 2) self.i.crafting[2] = Slot(bravo.blocks.blocks["wood"].slot, 0, 2) # Force crafting table to be rechecked. self.i.update_crafted() # Only checking count of crafted table; the previous test assured that # the recipe was selected. self.assertEqual(self.i.crafted[0], (bravo.blocks.items["stick"].slot, 0, 4)) def test_check_crafting_offset(self): self.i.crafting[1] = Slot(bravo.blocks.blocks["wood"].slot, 0, 1) self.i.crafting[3] = Slot(bravo.blocks.blocks["wood"].slot, 0, 1) # Force crafting table to be rechecked. self.i.update_crafted() self.assertTrue(self.i.recipe) self.assertEqual(self.i.recipe_offset, 1)
class TestCraftingSticks(unittest.TestCase): """ Test basic crafting functionality. Assumes that the basic wood->stick recipe is present and enabled. This recipe was chosen because it is the simplest recipe with more than one ingredient. """ def setUp(self): self.i = Crafting() def test_check_crafting(self): self.i.crafting[0] = Slot(bravo.blocks.blocks["wood"].slot, 0, 1) self.i.crafting[2] = Slot(bravo.blocks.blocks["wood"].slot, 0, 1) # Force crafting table to be rechecked. self.i.update_crafted() self.assertTrue(self.i.recipe) self.assertEqual(self.i.crafted[0], (bravo.blocks.items["stick"].slot, 0, 4)) def test_check_crafting_multiple(self): self.i.crafting[0] = Slot(bravo.blocks.blocks["wood"].slot, 0, 2) self.i.crafting[2] = Slot(bravo.blocks.blocks["wood"].slot, 0, 2) # Force crafting table to be rechecked. self.i.update_crafted() # Only checking count of crafted table; the previous test assured that # the recipe was selected. self.assertEqual(self.i.crafted[0], (bravo.blocks.items["stick"].slot, 0, 4)) def test_check_crafting_offset(self): self.i.crafting[1] = Slot(bravo.blocks.blocks["wood"].slot, 0, 1) self.i.crafting[3] = Slot(bravo.blocks.blocks["wood"].slot, 0, 1) # Force crafting table to be rechecked. self.i.update_crafted() self.assertTrue(self.i.recipe)
class TestCraftingWood(unittest.TestCase): """ Test basic crafting functionality. These tests require a "wood" recipe, which turns logs into wood. This recipe was chosen because it is the simplest and most essential recipe from which all crafting is derived. """ def setUp(self): recipes = retrieve_plugins(IRecipe) if "wood" not in recipes: raise unittest.SkipTest("Plugin not present") self.i = Crafting() def test_check_crafting(self): self.i.crafting[0] = Slot(bravo.blocks.blocks["log"].slot, 0, 1) # Force crafting table to be rechecked. self.i.update_crafted() self.assertTrue(self.i.recipe) self.assertEqual(self.i.crafted[0], (bravo.blocks.blocks["wood"].slot, 0, 4)) def test_check_crafting_multiple(self): self.i.crafting[0] = Slot(bravo.blocks.blocks["log"].slot, 0, 2) # Force crafting table to be rechecked. self.i.update_crafted() # Only checking count of crafted table; the previous test assured that # the recipe was selected. self.assertEqual(self.i.crafted[0], (bravo.blocks.blocks["wood"].slot, 0, 4)) def test_check_crafting_offset(self): self.i.crafting[1] = Slot(bravo.blocks.blocks["log"].slot, 0, 1) # Force crafting table to be rechecked. self.i.update_crafted() self.assertTrue(self.i.recipe)
def setUp(self): self.i = Crafting()
def setUp(self): recipes = retrieve_plugins(IRecipe) if "wood" not in recipes: raise unittest.SkipTest("Plugin not present") self.i = Crafting()
def __init__(self, inventory): Window.__init__(self, 0, inventory, Crafting())