Beispiel #1
0
 def test_postions(self):
     range = Range((1, 3), (2, 4))
     assert range.toPositionTuples() == ((1, 3), (2, 4))
     assert not range.isInverse()
     assert range.isPositions()
     assert range.isTwoPositions()
     range.assertPositions()
     range.assertTwoPositions()
Beispiel #2
0
 def test_init_by_positions(self):
     pos1 = Position(1, 1)
     pos2 = Range(2, 2, isPosition=True)
     assert Range(pos1, pos2) == Range((1, 1), (2, 2))
     assert Range(pos2, pos1) == Range((2, 2), (1, 1))
     assert Range((1, 1), pos2) == Range((1, 1), (2, 2))
     assert Range(pos1, (2, 2)) == Range((1, 1), (2, 2))
Beispiel #3
0
 def test_NotOnePositionRangeException_2(self):
     range = Range((1, 3), (2, 4))
     range.assertOnePosition()
Beispiel #4
0
 def test_NotTwoLinesRangeException_2(self):
     range = Range((1, 3), (2, 4))
     range.assertTwoLines()
Beispiel #5
0
 def test_NotOneLineRangeException_2(self):
     range = Range((1, 3), (2, 4))
     range.assertOneLine()
Beispiel #6
0
 def test_zero(self):
     assert Range(0) == Range((0, None), (0, None))
     assert Range(0).isLines()
     assert Position(0, 0) == Range((0, 0), (0, 0))
     assert Position(0, 0).isOnePosition()
     assert Position(0, 0).toPositionTuple() == (0, 0)
Beispiel #7
0
 def test_firstPosition(self):
     assert Range((4, 1), (2, 3)).firstPosition() == (Position(4, 1))
Beispiel #8
0
 def test_upperY(self):
     assert Range((4, 1), (2, 3)).upperY() == 2
Beispiel #9
0
 def test_toLineTuples(self):
     assert Range(3, 2).toLineTuples() == (3, 2)
Beispiel #10
0
 def test_toPositionTuples(self):
     assert Range((3, 1), (4, 2)).toPositionTuples() == ((3, 1), (4, 2))
Beispiel #11
0
 def test_linewise(self):
     lines = Range((3, 1), (2, 1)).linewise()
     assert lines == Range(3, 2)
Beispiel #12
0
 def test_contains(self):
     range = Range((3, 3), (5, 5))
     assert not range.contains(Position(2, 2))
     assert not range.contains(Position(3, 2))
     assert range.contains(Position(3, 3))
     assert range.contains(Position(4, 4))
     assert range.contains(Position(5, 5))
     assert not range.contains(Position(5, 6))
     assert not range.contains(Position(6, 6))
     range = Range((3, 3), (3, 5))
     assert not range.contains(Position(2, 2))
     assert not range.contains(Position(3, 2))
     assert range.contains(Position(3, 3))
     assert range.contains(Position(3, 5))
     assert not range.contains(Position(3, 6))
     assert not range.contains(Position(4, 4))
Beispiel #13
0
 def test_NotTwoPositionsRangeException_2(self):
     range = Range((1, 3), (1, 3))
     range.assertTwoPositions()
Beispiel #14
0
 def test_swap(self):
     assert Range((2, 3), (4, 1)).swap() == Range((4, 1), (2, 3))
Beispiel #15
0
 def test_firstX(self):
     assert Range((4, 1), (2, 3)).firstX() == 1
Beispiel #16
0
 def test_upperPosition(self):
     assert Range((4, 1), (2, 3)).upperPosition() == (Position(2, 3))
Beispiel #17
0
 def test_lastPosition(self):
     assert Range((4, 1), (2, 3)).lastPosition() == (Position(2, 3))
Beispiel #18
0
 def test_position(self):
     range = Range(1, 3, isPosition=True)
     range2 = Range((1, 3), isPosition=True)
     range3 = Range((1, 3), (1, 3))
     assert range == range2
     assert range == range3
     assert range.toPositionTuple() == (1, 3)
     assert range.toPositionTuples() == ((1, 3), (1, 3))
     assert not range.isInverse()
     assert range.isPositions()
     assert range.isOnePosition()
     range.assertPositions()
     range.assertOnePosition()
Beispiel #19
0
 def test_lastX(self):
     assert Range((4, 1), (2, 3)).lastX() == 3
Beispiel #20
0
 def test_line(self):
     range = Range(3)
     assert range == Range(3, 3)
     assert range.upperY() == 3
     assert range.lowerY() == 3
     assert range.toLineTuples() == (3, 3)
     assert not range.isInverse()
     assert range.isLines()
     assert range.isOneLine()
     range.assertLines()
     range.assertOneLine()
Beispiel #21
0
 def test_lines(self):
     range = Range(1, 3)
     assert range == Range((1, 3))
     assert range.toLineTuples() == (1, 3)
     assert not range.isInverse()
     assert range.isLines()
     assert range.isTwoLines()
     range.assertLines()
     range.assertTwoLines()
Beispiel #22
0
 def test_isInverse(self):
     assert Range(3, 2).isInverse()
     assert Range((3, 1), (2, 1)).isInverse()
     assert Range((3, 3), (3, 2)).isInverse()
Beispiel #23
0
 def test_linewise(self):
     assert Range((4, 1), (2, 3)).linewise() == Range(4, 2)
Beispiel #24
0
 def test_NotOneLineRangeException_1(self):
     range = Range(1, 3)
     range.assertOneLine()
Beispiel #25
0
 def test_lowerPosition(self):
     assert Range((4, 1), (2, 3)).lowerPosition() == (Position(4, 1))
Beispiel #26
0
 def test_NotTwoLinesRangeException_1(self):
     range = Range(1)
     range.assertTwoLines()
Beispiel #27
0
 def test_lowerY(self):
     assert Range((4, 1), (2, 3)).lowerY() == 4
Beispiel #28
0
 def test_NotPositionsRangeException_1(self):
     range = Range(1, 3)
     range.assertPositions()
Beispiel #29
0
 def test_NotOnePositionRangeException_1(self):
     range = Range(1, 3)
     range.assertOnePosition()