def test_mul(self): node = Node(1.1, -2.0, 'curve', True) product = node * 5 assert product.position() == (5.5, -10.0) assert product.style() == node.style() assert product.fusable() == node.fusable() product = node * (2, 3) assert product.position() == (2.2, -6.0) assert product.style() == node.style() assert product.fusable() == node.fusable()
def test_add(self): node1 = Node(1.1, -3.0, 'curve', True) node2 = Node(-4.0, 9.1, 'miter', False) sum1 = node1 + node2 sum2 = node2 + node1 assert sum1.position() == (-2.9, 6.1) assert sum2.position() == sum1.position() assert sum1.style() == node1.style() assert sum1.fusable() == node1.fusable() assert sum2.style() == node2.style() assert sum2.fusable() == node2.fusable()
def test_sub(self): node1 = Node(1.1, -3.0, 'curve', True) node2 = Node(-4.0, 9.2, 'miter', False) sum1 = node1 - node2 sum2 = node2 - node1 assert sum1.position() == (5.1, -12.2) assert sum2.position() == (-5.1, 12.2) assert sum1.style() == node1.style() assert sum1.fusable() == node1.fusable() assert sum2.style() == node2.style() assert sum2.fusable() == node2.fusable()
def test_init(self): node = Node(3.2, 5.0) assert node.position() == (3.2, 5.0) assert node.style() == 'miter' assert node.fusable() == True node = Node(3.2, 5.0, 'curve', False) assert node.position() == (3.2, 5.0) assert node.style() == 'curve' assert node.fusable() == False node = Node(3.2, 5.0, 'dummy', False)
def test_div(self): node = Node(5.5, -10.0, 'curve', True) quotient = node / 5 assert quotient.position() == (1.1, -2.0) assert quotient.style() == node.style() assert quotient.fusable() == node.fusable() quotient = node / 'a'
def test_style(self): node = Node(0, 0, 'miter') assert node.style() == 'miter' node = Node(0, 0, 'curve') assert node.style() == 'curve'