Content-Length: 27416 | pFad | http://github.com/willprice/chiplotle/commit/7ffe19aeed807430fd3d5ff4d8f7eee8b3487c47.diff

67 diff --git a/src/chiplotle/geometry/core/test/test_coordinate_add.py b/src/chiplotle/geometry/core/test/test_coordinate_add.py index c661bed..e4fb23f 100644 --- a/src/chiplotle/geometry/core/test/test_coordinate_add.py +++ b/src/chiplotle/geometry/core/test/test_coordinate_add.py @@ -38,25 +38,29 @@ def test_coordinate__radd__02(): def test_coordinate__add__03(): """A Coordinate and a float scalar cannot be added.""" a = Coordinate(1, 2) - assert raises(TypeError, "t = a + 4.2") + with raises(TypeError): + t = a + 4.2 def test_coordinate__radd__03(): """A float scalar and a Coordinate can be added.""" a = Coordinate(1, 2) - assert raises(TypeError, "t = 4.2 + a") + with raises(TypeError): + t = 4.2 + a def test_coordinate__add__04(): """A Coordinate and a tuple pair cannot be added.""" a = Coordinate(1, 2) - assert raises(TypeError, "a + (3, 4)") + with raises(TypeError): + a + (3, 4) def test_coordinate__radd__04(): """A tuple pair and a Coordinate cannot be added.""" a = Coordinate(1, 2) - assert raises(TypeError, "(3, 4) + a") + with raises(TypeError): + (3, 4) + a def test_coordinate__add__05(): @@ -83,11 +87,13 @@ def test_coordinate__add__06(): """A 2D Coordinate and a triple cannot be added.""" a = Coordinate(1, 2) b = (3, 4, 5) - assert raises(TypeError, "a + b") + with raises(TypeError): + a + b def test_coordinate__radd__06(): """A triple and a 2D Coordinate cannot be added.""" a = Coordinate(1, 2) b = (3, 4, 5) - assert raises(TypeError, "b + a") + with raises(TypeError): + b + a diff --git a/src/chiplotle/geometry/core/test/test_coordinate_init.py b/src/chiplotle/geometry/core/test/test_coordinate_init.py index 593b48f..e4d3953 100644 --- a/src/chiplotle/geometry/core/test/test_coordinate_init.py +++ b/src/chiplotle/geometry/core/test/test_coordinate_init.py @@ -21,14 +21,16 @@ def test_coordinate__init__01(): def test_coordinate__init__02(): """Coordinate cannot be initialized with a duple.""" - assert raises(TypeError, "Coordinate((1, 2))") + with raises(TypeError): + Coordinate((1, 2)) def test_coordinate__init__03(): """Coordinate cannot be initialized with a Coordinate.""" ##In this case, the constructor returns the existing coordinate.''' a = Coordinate(1, 2) - assert raises(TypeError, "t = Coordinate(a)") + with raises(TypeError): + t = Coordinate(a) def test_coordinate__init__04(): @@ -46,12 +48,14 @@ def test_coordinate__init__05(): def test_coordinate__init__06(): """Coordinate cannot be initialized with a triple.""" - assert raises(TypeError, "t = Coordinate((1, 2, 3))") + with raises(TypeError): + t = Coordinate((1, 2, 3)) def test_coordinate__init__07(): """Coordinate cannot be initialized with a Path.""" - assert raises(TypeError, "t = Coordinate(Path([(1, 2)]))") + with raises(TypeError): + t = Coordinate(Path([(1, 2)])) ## attribute assignment ## @@ -61,9 +65,12 @@ def test_coordinate_attribute_assignment_01(): """Coordinates are immutable. Attributes cannot be set (rebound).""" t = Coordinate(1, 2) - assert raises(AttributeError, "t.xy = 2") - assert raises(AttributeError, "t.foo = 3") - assert raises(TypeError, "t[0] = 2") + with raises(AttributeError): + t.xy = 2 + with raises(AttributeError): + t.foo = 3 + with raises(TypeError): + t[0] = 2 ## __eq__ ## @@ -125,27 +132,31 @@ def test_coordinate__div__01(): def test_coordinate__div__02(): """Denominator 0 raises ZeroDivisionError.""" a = Coordinate(1, 2) - assert raises(ZeroDivisionError, "t = a / 0") + with raises(ZeroDivisionError): + t = a / 0 def test_coordinate__div__03(): """A Coordinate cannot be divided by a Coordinate.""" a = Coordinate(1, 2) b = Coordinate(2, 4) - assert raises(TypeError, "t = a / b") + with raises(TypeError): + t = a / b def test_coordinate__div__04(): """A Coordinate cannot be divided by a duple.""" a = Coordinate(1, 2) b = (2, 4) - assert raises(TypeError, "a / b") + with raises(TypeError): + a / b def test_coordinate__div__05(): """Division raises an Error on wrong type.""" a = Coordinate(1, 2) - assert raises(TypeError, "a / (1, 2, 3)") + with raises(TypeError): + a / (1, 2, 3) def test_coordinate__floordiv__01(): @@ -160,19 +171,22 @@ def test_coordinate__floordiv__02(): """Floor division does not work with two Coordinates.""" a = Coordinate(1, 2) b = Coordinate(2, -4) - assert raises(TypeError, "t = a // b") + with raises(TypeError): + t = a // b def test_coordinate__floordiv__03(): """Denominator 0 raises ZeroDivisionError.""" a = Coordinate(1, 2) - assert raises(ZeroDivisionError, "t = a // 0") + with raises(ZeroDivisionError): + t = a // 0 def test_coordinate__floordiv__04(): """Floor Division raises an OperandError on wrong type.""" a = Coordinate(1, 2) - assert raises(TypeError, "a // (1, 2, 3)") + with raises(TypeError): + a // (1, 2, 3) ## __hash__ ## @@ -200,7 +214,8 @@ def test_coordinate__getitem__01(): t = Coordinate(1, 2) assert t[0] == 1 assert t[1] == 2 - assert raises(IndexError, "t[3]") + with raises(IndexError): + t[3] ## __len__ ## diff --git a/src/chiplotle/geometry/core/test/test_coordinate_mul.py b/src/chiplotle/geometry/core/test/test_coordinate_mul.py index d455c89..b65417a 100644 --- a/src/chiplotle/geometry/core/test/test_coordinate_mul.py +++ b/src/chiplotle/geometry/core/test/test_coordinate_mul.py @@ -21,7 +21,8 @@ def test_coordinate__mul__01(): def test_coordinate__mul__02(): """A Coordinate cannot be multiplied with a pair.""" a = Coordinate(2, 3) - assert raises(TypeError, "a * (2, 3)") + with raises(TypeError): + a * (2, 3) def test_coordinate__mul__03(): diff --git a/src/chiplotle/geometry/core/test/test_coordinate_sub.py b/src/chiplotle/geometry/core/test/test_coordinate_sub.py index a95bf4b..0db1d7a 100644 --- a/src/chiplotle/geometry/core/test/test_coordinate_sub.py +++ b/src/chiplotle/geometry/core/test/test_coordinate_sub.py @@ -20,34 +20,40 @@ def test_coordinate__sub__01(): def test_coordinate__sub__02(): """Coordinate pair cannot substract a tuple.""" a = Coordinate(1, 2) - assert raises(TypeError, "a - (0.5, 0.5)") + with raises(TypeError): + a - (0.5, 0.5) def test_coordinate__rsub__02(): """A tuple cannot substract a Coordinate.""" a = Coordinate(1, 2) - assert raises(TypeError, "(0.5, 0.5) - a") + with raises(TypeError): + (0.5, 0.5) - a def test_coordinate__sub__03(): """An int cannot be substracted from a Coordinate.""" a = Coordinate(1, 2) - assert raises(TypeError, "a - 1") + with raises(TypeError): + a - 1 def test_coordinate__rsub__03(): """A Coordinate cannot be substracted from an int.""" a = Coordinate(1, 2) - assert raises(TypeError, "1 - a") + with raises(TypeError): + 1 - a def test_coordinate__sub__04(): """An float cannot be substracted from a Coordinate.""" a = Coordinate(1, 2) - assert raises(TypeError, "t = a - 1.5") + with raises(TypeError): + t = a - 1.5 def test_coordinate__rsub__04(): """A Coordinate cannot be substracted from a float.""" a = Coordinate(1, 2) - assert raises(TypeError, "t = 1.5 - a") + with raises(TypeError): + t = 1.5 - a diff --git a/src/chiplotle/geometry/core/test/test_coordinatearray_add.py b/src/chiplotle/geometry/core/test/test_coordinatearray_add.py index e2a4ff0..17fc844 100644 --- a/src/chiplotle/geometry/core/test/test_coordinatearray_add.py +++ b/src/chiplotle/geometry/core/test/test_coordinatearray_add.py @@ -23,31 +23,36 @@ def test_coordinatearray__add__02(): """Two CoordinateArrays of different length cannot be added.""" a = CoordinateArray([(1, 2), (3, 4)]) b = CoordinateArray([(1, 1), (2, 2), (3, 3)]) - assert raises(ValueError, "t = a + b") + with raises(ValueError): + t = a + b def test_coordinatearray__add__03(): """A CoordinateArray and an int cannot be added.""" a = CoordinateArray([(1, 2), (3, 4)]) - assert raises(TypeError, "t = a + 2") + with raises(TypeError): + t = a + 2 def test_coordinatearray__radd__04(): """An int and a CoordinateArray cannot be added.""" a = CoordinateArray([(1, 2), (3, 4)]) - assert raises(TypeError, "t = 2 + a") + with raises(TypeError): + t = 2 + a def test_coordinatearray__add__05(): """A CoordinateArray and a float cannot be added.""" a = CoordinateArray([(1, 2), (3, 4)]) - assert raises(TypeError, "t = a + 2.3") + with raises(TypeError): + t = a + 2.3 def test_coordinatearray__add__06(): """A float and a CoordinateArray cannot be added.""" a = CoordinateArray([(1, 2), (3, 4)]) - assert raises(TypeError, "t = 2.3 + a") + with raises(TypeError): + t = 2.3 + a def test_coordinatearray__add__07(): diff --git a/src/chiplotle/geometry/core/test/test_coordinatearray_append.py b/src/chiplotle/geometry/core/test/test_coordinatearray_append.py index 04cf1ee..30eb35e 100644 --- a/src/chiplotle/geometry/core/test/test_coordinatearray_append.py +++ b/src/chiplotle/geometry/core/test/test_coordinatearray_append.py @@ -11,7 +11,8 @@ def test_coordinatearray_append_01(): """CoordinateArray cannot be appended an (x, y) pair.""" t = CoordinateArray() - assert raises(TypeError, "t.append((0, 0))") + with raises(TypeError): + t.append((0, 0)) def test_coordinatearray_append_02(): diff --git a/src/chiplotle/geometry/core/test/test_coordinatearray_extend.py b/src/chiplotle/geometry/core/test/test_coordinatearray_extend.py index 2ea12c1..b244d32 100644 --- a/src/chiplotle/geometry/core/test/test_coordinatearray_extend.py +++ b/src/chiplotle/geometry/core/test/test_coordinatearray_extend.py @@ -11,7 +11,8 @@ def test_coordinatearray_extend_01(): """CoordinateArray cannot be extended with a list of (x, y) pairs.""" t = CoordinateArray() - assert raises(TypeError, "t.extend([(0, 0), (1, 2)])") + with raises(TypeError): + t.extend([(0, 0), (1, 2)]) def test_coordinatearray_extend_02(): @@ -26,4 +27,5 @@ def test_coordinatearray_extend_02(): def test_coordinatearray_extend_03(): """Mixtures are not allowed.""" t = CoordinateArray() - assert raises(TypeError, "t.extend([Coordinate(0, 0), (3, 2)])") + with raises(TypeError): + t.extend([Coordinate(0, 0), (3, 2)]) diff --git a/src/chiplotle/geometry/core/test/test_coordinatearray_init.py b/src/chiplotle/geometry/core/test/test_coordinatearray_init.py index 94bbe50..0a894c1 100644 --- a/src/chiplotle/geometry/core/test/test_coordinatearray_init.py +++ b/src/chiplotle/geometry/core/test/test_coordinatearray_init.py @@ -46,7 +46,8 @@ def test_coordinatearray__iadd__02(): t = CoordinateArray([(1, 2), (3, 4)]) tid = id(t) b = 1 - assert raises(TypeError, "t += b") + with raises(TypeError): + t += b ## div ## diff --git a/src/chiplotle/geometry/core/test/test_path_add.py b/src/chiplotle/geometry/core/test/test_path_add.py index cc0e231..3380aa0 100644 --- a/src/chiplotle/geometry/core/test/test_path_add.py +++ b/src/chiplotle/geometry/core/test/test_path_add.py @@ -11,17 +11,20 @@ def test_path_add_01(): """A Path and an int cannot be added.""" - assert raises(TypeError, "Path([(1, 2), (3, 4)]) + 3") + with raises(TypeError): + Path([(1, 2), (3, 4)]) + 3 def test_path_add_02(): """A Path and a float cannot be added.""" - assert raises(TypeError, "Path([(1, 2), (3, 4)]) + 3.2") + with raises(TypeError): + Path([(1, 2), (3, 4)]) + 3.2 def test_path_radd_02(): """A float and a Path cannot be added.""" - assert raises(TypeError, "3.2 + Path([(1, 2), (3, 4)])") + with raises(TypeError): + 3.2 + Path([(1, 2), (3, 4)]) def test_path_add_03(): @@ -45,26 +48,30 @@ def test_path_radd_03(): def test_path_add_04(): """A Path and a duple cannot be added.""" a = Path([(1, 2), (3, 4)]) - assert raises(TypeError, "a + (1, 2)") + with raises(TypeError): + a + (1, 2) def test_path_radd_04(): """A duple and a Path cannot be added.""" a = Path([(1, 2), (3, 4)]) - assert raises(TypeError, "(1, 2) + a") + with raises(TypeError): + (1, 2) + a def test_path_add_05(): """A 2D Path and a triple cannot be added.""" a = Path([(1, 2), (3, 4)]) - assert raises(TypeError, "a + (1, 2, 3)") + with raises(TypeError): + a + (1, 2, 3) def test_path_add_06(): """A Path and a Path cannot be added.""" a = Path([(1, 2), (3, 4)]) b = Path([(2, 3)]) - assert raises(TypeError, "a + b") + with raises(TypeError): + a + b ## in place addition __iadd__ ## @@ -73,4 +80,5 @@ def test_path_add_06(): def test_path_iadd_01(): """A float and a Path cannot be added.""" t = Path([(1, 2), (3, 4)]) - assert raises(TypeError, "t += 3.2") + with raises(TypeError): + t += 3.2 diff --git a/src/chiplotle/geometry/core/test/test_path_mul.py b/src/chiplotle/geometry/core/test/test_path_mul.py index aaacd21..53a27e2 100644 --- a/src/chiplotle/geometry/core/test/test_path_mul.py +++ b/src/chiplotle/geometry/core/test/test_path_mul.py @@ -29,16 +29,19 @@ def test_path_rmul_01(): def test_path_mul_02(): """A Path and a duple cannot be multiplied.""" a = Path([(1, 2), (3, 4)]) - assert raises(TypeError, "a * (1, 2)") + with raises(TypeError): + a * (1, 2) def test_path_rmul_02(): """A duple and a Path cannot be multiplied.""" a = Path([(1, 2), (3, 4)]) - assert raises(TypeError, "(1, 2) * a") + with raises(TypeError): + (1, 2) * a def test_path_mul_03(): """A Path cannot be multiplied with a triple.""" a = Path([(1, 2), (3, 4)]) - assert raises(TypeError, "a * (1, 2, 3)") + with raises(TypeError): + a * (1, 2, 3) diff --git a/src/chiplotle/geometry/core/test/test_path_sub.py b/src/chiplotle/geometry/core/test/test_path_sub.py index 692c782..9dbdd90 100644 --- a/src/chiplotle/geometry/core/test/test_path_sub.py +++ b/src/chiplotle/geometry/core/test/test_path_sub.py @@ -12,19 +12,22 @@ def test_path_sub_01(): """A Path cannot substract an int.""" a = Path([(1, 2), (3, 4)]) - assert raises(TypeError, "t = a - 2") + with raises(TypeError): + t = a - 2 def test_path_sub_02(): """A Path cannot substract a float.""" a = Path([(1, 2), (3, 4)]) - assert raises(TypeError, "t = a - 2.5") + with raises(TypeError): + t = a - 2.5 def test_path_rsub_02(): """A float cannot substract a Path.""" a = Path([(1, 2), (3, 4)]) - assert raises(TypeError, "t = 2.5 - a") + with raises(TypeError): + t = 2.5 - a def test_path_sub_03(): @@ -48,26 +51,30 @@ def test_path_rsub_03(): def test_path_sub_04(): """A Path cannot substract a duple.""" a = Path([(1, 2), (3, 4)]) - assert raises(TypeError, "a - (1, 2)") + with raises(TypeError): + a - (1, 2) def test_path_rsub_04(): """A duple cannot substract a Path.""" a = Path([(1, 2), (3, 4)]) - assert raises(TypeError, "(1, 2) - a") + with raises(TypeError): + (1, 2) - a def test_path_sub_05(): """A Path cannot substract a triple.""" a = Path([(1, 2), (3, 4)]) - assert raises(TypeError, "a - (1, 2, 3)") + with raises(TypeError): + a - (1, 2, 3) def test_path_sub_06(): """Two paths cannot be substracted.""" a = Path([(1, 2), (3, 4)]) b = Path([(2, 3)]) - assert raises(TypeError, "a - b") + with raises(TypeError): + a - b ## in place addition __isub__ ## @@ -76,4 +83,5 @@ def test_path_sub_06(): def test_path_isub_01(): """A float cannot be substracted from a Path in place.""" t = Path([(1, 2), (3, 4)]) - assert raises(TypeError, "t -= 2.5") + with raises(TypeError): + t -= 2.5 diff --git a/src/chiplotle/hpgl/test/test_AA.py b/src/chiplotle/hpgl/test/test_AA.py index ee94dfe..f7c1b32 100644 --- a/src/chiplotle/hpgl/test/test_AA.py +++ b/src/chiplotle/hpgl/test/test_AA.py @@ -26,7 +26,8 @@ def test_AA_02(): def test_AA_03(): """AA must take at least two arguments: position and angle.""" - assert pytest.raises(TypeError, "AA((0, 0))") + with pytest.raises(TypeError): + AA((0, 0)) def test_AA_format_01(): @@ -45,7 +46,8 @@ def test_AA_format_02(): def test_AA_angle_01(): """Angle must be between -360 and 360.""" - assert pytest.raises(ValueError, "AA((0, 0), 1200)") + with pytest.raises(ValueError): + AA((0, 0), 1200) ## eq ## diff --git a/src/chiplotle/hpgl/test/test_AR.py b/src/chiplotle/hpgl/test/test_AR.py index dcfc9c4..5b8ea55 100644 --- a/src/chiplotle/hpgl/test/test_AR.py +++ b/src/chiplotle/hpgl/test/test_AR.py @@ -27,7 +27,8 @@ def test_AR_02(): def test_AR_03(): """AR must take at least two arguments: position and angle.""" - assert pytest.raises(TypeError, "AR((0, 0))") + with pytest.raises(TypeError): + AR((0, 0)) def test_AR_format_01(): diff --git a/src/chiplotle/hpgl/test/test_CI.py b/src/chiplotle/hpgl/test/test_CI.py index b0d203c..0ac8515 100644 --- a/src/chiplotle/hpgl/test/test_CI.py +++ b/src/chiplotle/hpgl/test/test_CI.py @@ -11,7 +11,8 @@ def test_CI_01(): """CI must have at least one argument (radius).""" - assert raises(TypeError, "CI()") + with raises(TypeError): + CI() def test_CI_02(): @@ -33,10 +34,3 @@ def test_CI_03(): def test_CI_scalable_01(): assert CI._scalable == ["radius"] - - -### RADIUS ### - -# def test_CI_radius_02( ): -# '''Radius must be scalar.''' -# assert raises(TypeError, 't = CI([1])') diff --git a/src/chiplotle/hpgl/test/test_DI.py b/src/chiplotle/hpgl/test/test_DI.py index 1cf97da..ddfb60a 100644 --- a/src/chiplotle/hpgl/test/test_DI.py +++ b/src/chiplotle/hpgl/test/test_DI.py @@ -22,7 +22,8 @@ def test_DI_02(): assert t.run == 23 assert t.rise == None - assert raises(Warning, "t.format") + with raises(Warning): + t.format def test_DI_03(): diff --git a/src/chiplotle/hpgl/test/test_DR.py b/src/chiplotle/hpgl/test/test_DR.py index 9907d83..2637b3c 100644 --- a/src/chiplotle/hpgl/test/test_DR.py +++ b/src/chiplotle/hpgl/test/test_DR.py @@ -22,7 +22,8 @@ def test_DR_02(): assert t.run == 23 assert t.rise == None - assert raises(Warning, "t.format") + with raises(Warning): + t.format def test_DR_03(): @@ -35,7 +36,7 @@ def test_DR_03(): assert t.format == b"DR0.00,25.30;" -def test_DR_03(): +def test_DR_04(): """rise can be 0.""" t = DR(10, 0) diff --git a/src/chiplotle/hpgl/test/test_EA.py b/src/chiplotle/hpgl/test/test_EA.py index 3cc6556..abac00b 100644 --- a/src/chiplotle/hpgl/test/test_EA.py +++ b/src/chiplotle/hpgl/test/test_EA.py @@ -12,12 +12,14 @@ def test_EA_01(): """EA cannot initialize with a scalar.""" - assert raises(TypeError, "t = EA(1)") + with raises(TypeError): + t = EA(1) def test_EA_02(): """EA cannot initialize with a list of length > 2.""" - assert raises(ValueError, "t = EA([1, 2, 3, 4])") + with raises(ValueError): + t = EA([1, 2, 3, 4]) def test_EA_03(): diff --git a/src/chiplotle/hpgl/test/test_ER.py b/src/chiplotle/hpgl/test/test_ER.py index f7af378..131200c 100644 --- a/src/chiplotle/hpgl/test/test_ER.py +++ b/src/chiplotle/hpgl/test/test_ER.py @@ -11,12 +11,14 @@ def test_ER_01(): """ER cannot initialize with a scalar.""" - assert raises(TypeError, "t = ER(1)") + with raises(TypeError): + t = ER(1) def test_ER_02(): """ER cannot initialize with a list of length > 2.""" - assert raises(ValueError, "t = ER([1, 2, 3, 4])") + with raises(ValueError): + t = ER([1, 2, 3, 4]) def test_ER_03(): diff --git a/src/chiplotle/hpgl/test/test_FT.py b/src/chiplotle/hpgl/test/test_FT.py index f52a258..816456d 100644 --- a/src/chiplotle/hpgl/test/test_FT.py +++ b/src/chiplotle/hpgl/test/test_FT.py @@ -44,4 +44,5 @@ def test_FT_05(): assert t.type is None assert t.space == 0.23 assert t.angle is None - assert raises(Warning, "t.format") + with raises(Warning): + t.format diff --git a/src/chiplotle/hpgl/test/test_SI.py b/src/chiplotle/hpgl/test/test_SI.py index 5f6a683..1ad6b1d 100644 --- a/src/chiplotle/hpgl/test/test_SI.py +++ b/src/chiplotle/hpgl/test/test_SI.py @@ -11,18 +11,15 @@ def test_SI_01(): """SI has default values.""" t = SI() - assert t.format == b"SI;" def test_SI_02(): t = SI(3, 2) - assert t.format == b"SI3.00,2.00;" def test_SI_03(): - t = SI(3) - - assert pytest.raises(Warning, "t.format") + with pytest.raises(Warning): + t.format diff --git a/src/chiplotle/hpgl/test/test_SR.py b/src/chiplotle/hpgl/test/test_SR.py index 5d6aece..d7d696c 100644 --- a/src/chiplotle/hpgl/test/test_SR.py +++ b/src/chiplotle/hpgl/test/test_SR.py @@ -10,21 +10,16 @@ def test_SR_01(): """SR can be initialized empty.""" - t = SR() - assert t.format == b"SR;" def test_SR_02(): - t = SR(3, 2) - assert t.format == b"SR3.00,2.00;" def test_SR_03(): - t = SR(3) - - assert pytest.raises(Warning, "t.format") + with pytest.raises(Warning): + t.format diff --git a/src/chiplotle/hpgl/test/test_dci_sethandshakemode.py b/src/chiplotle/hpgl/test/test_dci_sethandshakemode.py index 46fdcd9..2f1d47d 100644 --- a/src/chiplotle/hpgl/test/test_dci_sethandshakemode.py +++ b/src/chiplotle/hpgl/test/test_dci_sethandshakemode.py @@ -24,4 +24,5 @@ def test_dci_sethandshakemode_02(): def test_dci_sethandshakemode_03(): """SetHandshakeMode cannot take a value other than None, 0, 1, 2 or 3.""" - assert raises(ValueError, "t = SetHandshakeMode(32)") + with raises(ValueError): + t = SetHandshakeMode(32) diff --git a/src/chiplotle/hpgl/test/test_pen.py b/src/chiplotle/hpgl/test/test_pen.py index cc61de0..1c8d76c 100644 --- a/src/chiplotle/hpgl/test/test_pen.py +++ b/src/chiplotle/hpgl/test/test_pen.py @@ -12,7 +12,8 @@ def test_pen_01(): """Pen must take one argument at least.""" - assert pytest.raises(TypeError, "t = Pen( )") + with pytest.raises(TypeError): + t = Pen() def test_pen_02(): diff --git a/src/chiplotle/hpgl/test/test_penplot.py b/src/chiplotle/hpgl/test/test_penplot.py index 2998531..8d37d4a 100644 --- a/src/chiplotle/hpgl/test/test_penplot.py +++ b/src/chiplotle/hpgl/test/test_penplot.py @@ -21,7 +21,8 @@ def test_penplot_01(): def test_penplot_03(): """xy cannot be set with an single number.""" p = _PenPlot([(1, 2)]) - assert raises(TypeError, "p.xy = 3") + with raises(TypeError): + p.xy = 3 def test_penplot_04(): @@ -38,8 +39,10 @@ def test_penplot_04(): def test_penplot_05(): """xy assignment must have lenth == 2*n""" p = _PenPlot([(0, 0)]) - assert raises(TypeError, "p.xy =(1,)") - assert raises(TypeError, "p.xy =(1,2,3)") + with raises(TypeError): + p.xy = (1,) + with raises(TypeError): + p.xy = (1, 2, 3) def test_penplot_06(): diff --git a/src/chiplotle/tools/hpgltools/test/test_convert_coordinates_to_absolute_path.py b/src/chiplotle/tools/hpgltools/test/test_convert_coordinates_to_absolute_path.py index 88be209..da4c452 100644 --- a/src/chiplotle/tools/hpgltools/test/test_convert_coordinates_to_absolute_path.py +++ b/src/chiplotle/tools/hpgltools/test/test_convert_coordinates_to_absolute_path.py @@ -43,4 +43,5 @@ def test_convert_coordinates_to_absolute_hpgl_path_03(): def test_convert_coordinates_to_absolute_hpgl_path_04(): """Argument must be a list of coordinate pairs..""" c = [1, 2, 3, 4] - assert raises(TypeError, "hpgltools.convert_coordinates_to_hpgl_absolute_path(c)") + with raises(TypeError): + hpgltools.convert_coordinates_to_hpgl_absolute_path(c) diff --git a/src/chiplotle/tools/hpgltools/test/test_inflate_hpgl_string.py b/src/chiplotle/tools/hpgltools/test/test_inflate_hpgl_string.py index 20dfbae..1fc768f 100644 --- a/src/chiplotle/tools/hpgltools/test/test_inflate_hpgl_string.py +++ b/src/chiplotle/tools/hpgltools/test/test_inflate_hpgl_string.py @@ -18,7 +18,8 @@ def test_inflate_hpgl_string_01(): def test_inflate_hpgl_string_02(): """The first argument must be a string.""" - assert raises(TypeError, "t = hpgltools.inflate_hpgl_string([1,2,3])") + with raises(TypeError): + t = hpgltools.inflate_hpgl_string([1, 2, 3]) def test_inflate_hpgl_string_03(): @@ -105,6 +106,6 @@ def test_inflate_hpgl_string__filter_01(): def test_inflate_hpgl_string__filter_02(): """The `filter_commands' argument must be a list of two-letter HPGL strings.""" - e = "t = hpgltools.inflate_hpgl_string('IN;PU;PA10,10;CI100;', 'IN;PU;')" - assert raises(TypeError, e) + with raises(TypeError): + t = hpgltools.inflate_hpgl_string("IN;PU;PA10,10;CI100;", "IN;PU;") diff --git a/src/chiplotle/tools/mathtools/test/test_mathtools_factors.py b/src/chiplotle/tools/mathtools/test/test_mathtools_factors.py index 753541d..46ee36a 100644 --- a/src/chiplotle/tools/mathtools/test/test_mathtools_factors.py +++ b/src/chiplotle/tools/mathtools/test/test_mathtools_factors.py @@ -9,8 +9,10 @@ def test_mathtools_factors_01(): - assert pytest.raises(TypeError, "mathtools.factors(7.5)") - assert pytest.raises(ValueError, "mathtools.factors(0)") + with pytest.raises(TypeError): + mathtools.factors(7.5) + with pytest.raises(ValueError): + mathtools.factors(0) def test_mathtools_factors_02(): diff --git a/src/chiplotle/tools/mathtools/test/test_polar_to_xy.py b/src/chiplotle/tools/mathtools/test/test_polar_to_xy.py index 610500d..e577ff2 100644 --- a/src/chiplotle/tools/mathtools/test/test_polar_to_xy.py +++ b/src/chiplotle/tools/mathtools/test/test_polar_to_xy.py @@ -23,22 +23,26 @@ def test_polar_to_xy_01(): def test_polar_to_xy_02(): """The function cannot take two values r and A""" - assert raises(TypeError, "mathtools.polar_to_xy(1, 0)") + with raises(TypeError): + mathtools.polar_to_xy(1, 0) def test_polar_to_xy_03(): """Three arguments throw a TypeError.""" - assert raises(TypeError, "mathtools.polar_to_xy(1, 2, 3)") + with raises(TypeError): + mathtools.polar_to_xy(1, 2, 3) def test_polar_to_xy_04(): """One numeric argument throws a TypeError.""" - assert raises(TypeError, "mathtools.polar_to_xy(1)") + with raises(TypeError): + mathtools.polar_to_xy(1) def test_polar_to_xy_05(): """One tuple argument with > 2 arguments throws a TypeError.""" - assert raises(TypeError, "mathtools.polar_to_xy((1, 2, 3))") + with raises(TypeError): + mathtools.polar_to_xy((1, 2, 3)) ## values 90 degs. ##








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/willprice/chiplotle/commit/7ffe19aeed807430fd3d5ff4d8f7eee8b3487c47.diff

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy