Exemple #1
0
 def test_state_more(self):
     b1 = Block('piston', dict(facing='up'))
     b2 = b1.state(extended=True)
     self.assertEqual(b1.block_id, 'piston')
     self.assertEqual(b1.block_state, BlockState(facing='up'))
     self.assertEqual(b2.block_id, 'piston')
     self.assertEqual(b2.block_state, BlockState(facing='up', extended=True))
Exemple #2
0
 def test_state_overwrite(self):
     b1 = Block('piston', dict(facing='up'))
     b2 = b1.state(facing='down')
     self.assertEqual(b1.block_id, 'piston')
     self.assertEqual(b1.block_state, BlockState(facing='up'))
     self.assertEqual(b2.block_id, 'piston')
     self.assertEqual(b2.block_state, BlockState(facing='down'))
Exemple #3
0
 def test_state(self):
     b1 = Block('piston')
     b2 = b1.state(facing='up')
     self.assertEqual(b1.block_id, 'piston')
     self.assertEqual(b1.block_state, BlockState())
     self.assertEqual(b2.block_id, 'piston')
     self.assertEqual(b2.block_state, BlockState(facing='up'))
 def __init__(self,
              position: Position.Generic,
              block: Block.Generic,
              old_block_handling: str = None):
     self.position: Position = Position.sift(position)
     self.block: Block = Block.sift(block)
     self.old_block_handling: Union[str, None] = old_block_handling
Exemple #5
0
 def __init__(self,
              position: Position.Generic,
              block: Block.Generic,
              subcommand: ExecuteCommand = None):
     self.position: Position = Position.sift(position)
     self.block: Block = Block.sift(block)
     self.subcommand: Union[ExecuteCommand, None] = subcommand
Exemple #6
0
 def test_block_with_id_and_state(self):
     cmd = commands.setblock(position=ZERO_OFFSET,
                             block=Block(block_id='dropper',
                                         block_state=dict(facing='up')))
     self.assertEqual(str(cmd), 'setblock ~ ~ ~ dropper[facing=up]')
Exemple #7
0
 def test_block_with_id(self):
     b = Block('piston')
     self.assertEqual(b.block_id, 'piston')
Exemple #8
0
 def test_block_state_from_braces(self):
     b = Block('piston', {'facing': 'up'})
     self.assertEqual(b.block_state, BlockState(facing='up'))
Exemple #9
0
 def test_block_state_from_dict(self):
     b = Block('piston', dict(facing='up'))
     self.assertEqual(b.block_state, BlockState(facing='up'))
Exemple #10
0
 def test_block_with_id_and_block_state(self):
     b = Block('piston', BlockState(facing='up'))
     self.assertEqual(b.block_id, 'piston')
     self.assertEqual(b.block_state, BlockState(facing='up'))