示例#1
0
def test_truediv_position_by_big_float():
    p = Position.from_xyz(4, 5, 6)
    assert str(p / 2.5) == "1.6 2 2.4"
示例#2
0
def test_add_position_to_tuple():
    p1 = (1, 2, 3)
    p2 = Position.from_xyz(4, 5, 6)
    assert str(p1 + p2) == "5 7 9"
示例#3
0
def test_add_position_to_list():
    p1 = [1, 2, 3]
    p2 = Position.from_xyz(4, 5, 6)
    assert str(p1 + p2) == "~5 ~7 ~9"
示例#4
0
def test_position_neg_with_positive_coords():
    p1 = Position.from_xyz(1, 2, 3)
    assert str(p1) == "1 2 3"
    p2 = -p1
    assert str(p2) == "-1 -2 -3"
示例#5
0
def test_add_two_positions():
    p1 = Position.from_xyz(1, 2, 3)
    p2 = Position.from_xyz(4, 5, 6)
    assert str(p1 + p2) == "5 7 9"
示例#6
0
def test_position_pos_turns_coord_sign_absolute():
    p1 = ~Position.from_xyz(1, 2, 3)
    assert str(p1) == "~1 ~2 ~3"
    p2 = +p1
    assert str(p2) == "1 2 3"
示例#7
0
def test_position_abs():
    p1 = Position.from_xyz(-1, 2, -3)
    assert str(p1) == "-1 2 -3"
    p2 = abs(p1)
    assert str(p2) == "1 2 3"
示例#8
0
def test_floordiv_position_with_relative_coords():
    p = ~Position.from_xyz(4, 5, 6)
    assert str(p // 10) == "~ ~ ~"
示例#9
0
def test_floordiv_position_with_local_coords():
    p = Position.from_xyz(4, 5, 6).local()
    assert str(p // 10) == "^ ^ ^"
示例#10
0
def test_floordiv_position_by_big_float():
    p = Position.from_xyz(4, 5, 6)
    assert str(p // 2.5) == "1 2 2"
示例#11
0
def test_floordiv_position_by_small_float():
    p = Position.from_xyz(4, 5, 6)
    assert str(p // 0.5) == "8 10 12"
示例#12
0
def test_floordiv_position_by_int():
    p = Position.from_xyz(4, 5, 6)
    assert str(p // 10) == "0 0 0"
示例#13
0
def test_truediv_position_with_local_coords():
    p = Position.from_xyz(4, 5, 6).local()
    assert str(p / 10) == "^0.4 ^0.5 ^0.6"
示例#14
0
def test_truediv_position_with_relative_coords():
    p = ~Position.from_xyz(4, 5, 6)
    assert str(p / 10) == "~0.4 ~0.5 ~0.6"
示例#15
0
def test_pow_position_by_small_float():
    p = Position.from_xyz(4, 9, 16)
    assert str(p**0.5) == "2 3 4"
示例#16
0
def test_modulo_position_by_int():
    p = Position.from_xyz(4, 5, 6)
    assert str(p % 3) == "1 2 0"
示例#17
0
def test_pow_position_with_relative_coords():
    p = ~Position.from_xyz(4, 9, 16)
    assert str(p**2) == "~16 ~81 ~256"
示例#18
0
def test_modulo_position_by_big_float():
    p = Position.from_xyz(4, 5, 6)
    assert str(p % 1.5) == "1 0.5 0"
示例#19
0
def test_pow_position_with_local_coords():
    p = Position.from_xyz(4, 9, 16).local()
    assert str(p**2) == "^16 ^81 ^256"
示例#20
0
def test_modulo_position_by_small_float():
    p = Position.from_xyz(4, 5, 6)
    assert str(p % 0.9) == "0.4 0.5 0.6"
示例#21
0
def test_position_abs_does_not_turn_coord_sign_absolute():
    p1 = ~Position.from_xyz(1, 2, 3)
    assert str(p1) == "~1 ~2 ~3"
    p2 = abs(p1)
    assert str(p2) == "~1 ~2 ~3"
示例#22
0
def test_modulo_position_with_relative_coords():
    p = ~Position.from_xyz(4, 5, 6)
    assert str(p % 3) == "~1 ~2 ~"
示例#23
0
def test_position_invert_turns_coord_sign_relative():
    p1 = Position.from_xyz(1, 2, 3)
    assert str(p1) == "1 2 3"
    p2 = ~p1
    assert str(p2) == "~1 ~2 ~3"
示例#24
0
def test_modulo_position_with_local_coords():
    p = Position.from_xyz(4, 5, 6).local()
    assert str(p % 3) == "^1 ^2 ^"
示例#25
0
def test_add_tuple_to_position():
    p1 = Position.from_xyz(1, 2, 3)
    p2 = (4, 5, 6)
    assert str(p1 + p2) == "5 7 9"
示例#26
0
def test_pow_position_by_int():
    p = Position.from_xyz(4, 9, 16)
    assert str(p**2) == "16 81 256"
示例#27
0
def test_add_list_to_position():
    p1 = Position.from_xyz(1, 2, 3)
    p2 = [4, 5, 6]
    assert str(p1 + p2) == "5 7 9"
示例#28
0
def test_pow_position_by_big_float():
    p = Position.from_xyz(4, 9, 16)
    assert str(p**1.5) == "8 27 64"
示例#29
0
def test_add_absolute_position_to_relative_position():
    p1 = ~Position.from_xyz(1, 2, 3)
    p2 = Position.from_xyz(4, 5, 6)
    assert str(p1 + p2) == "~5 ~7 ~9"
示例#30
0
def test_position_neg_with_mixed_coords():
    p1 = Position.from_xyz(-1, 2, -3)
    assert str(p1) == "-1 2 -3"
    p2 = -p1
    assert str(p2) == "1 -2 3"