pylint3 cleanup of unit tests
This commit is contained in:
@@ -26,7 +26,6 @@ import Path
|
||||
import PathScripts.PathDeburr as PathDeburr
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathTests.PathTestUtils as PathTestUtils
|
||||
import math
|
||||
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
#PathLog.trackModule(PathLog.thisModule())
|
||||
|
||||
@@ -24,14 +24,10 @@
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts
|
||||
import PathScripts.PathDressupDogbone as PathDressupDogbone
|
||||
import PathScripts.PathJob as PathJob
|
||||
import PathScripts.PathProfileFaces as PathProfileFaces
|
||||
import math
|
||||
import unittest
|
||||
|
||||
from FreeCAD import Vector
|
||||
from PathTests.PathTestUtils import PathTestBase
|
||||
|
||||
class TestProfile:
|
||||
@@ -48,6 +44,7 @@ class TestFeature:
|
||||
self.Path = Path.Path()
|
||||
|
||||
def addProperty(self, typ, nam, category, tip):
|
||||
# pylint: disable=unused-argument
|
||||
setattr(self, nam, None)
|
||||
|
||||
def setEditorMode(self, prop, mode):
|
||||
@@ -61,31 +58,29 @@ class TestDressupDogbone(PathTestBase):
|
||||
|
||||
def test00(self):
|
||||
'''Verify bones are inserted for simple moves.'''
|
||||
path = []
|
||||
base = TestProfile('Inside', 'CW', 'G0 X10 Y10 Z10\nG1 Z0\nG1 Y100\nG1 X12\nG1 Y10\nG1 X10\nG1 Z10')
|
||||
obj = TestFeature()
|
||||
db = PathDressupDogbone.ObjectDressup(obj, base)
|
||||
db.setup(obj, True)
|
||||
db.execute(obj, False)
|
||||
self.assertEquals(len(db.bones), 4)
|
||||
self.assertEquals("1: (10.00, 100.00)", self.formatBone(db.bones[0]))
|
||||
self.assertEquals("2: (12.00, 100.00)", self.formatBone(db.bones[1]))
|
||||
self.assertEquals("3: (12.00, 10.00)", self.formatBone(db.bones[2]))
|
||||
self.assertEquals("4: (10.00, 10.00)", self.formatBone(db.bones[3]))
|
||||
self.assertEqual(len(db.bones), 4)
|
||||
self.assertEqual("1: (10.00, 100.00)", self.formatBone(db.bones[0]))
|
||||
self.assertEqual("2: (12.00, 100.00)", self.formatBone(db.bones[1]))
|
||||
self.assertEqual("3: (12.00, 10.00)", self.formatBone(db.bones[2]))
|
||||
self.assertEqual("4: (10.00, 10.00)", self.formatBone(db.bones[3]))
|
||||
|
||||
def test01(self):
|
||||
'''Verify bones are inserted if hole ends with rapid move out.'''
|
||||
path = []
|
||||
base = TestProfile('Inside', 'CW', 'G0 X10 Y10 Z10\nG1 Z0\nG1 Y100\nG1 X12\nG1 Y10\nG1 X10\nG0 Z10')
|
||||
obj = TestFeature()
|
||||
db = PathDressupDogbone.ObjectDressup(obj, base)
|
||||
db.setup(obj, True)
|
||||
db.execute(obj, False)
|
||||
self.assertEquals(len(db.bones), 4)
|
||||
self.assertEquals("1: (10.00, 100.00)", self.formatBone(db.bones[0]))
|
||||
self.assertEquals("2: (12.00, 100.00)", self.formatBone(db.bones[1]))
|
||||
self.assertEquals("3: (12.00, 10.00)", self.formatBone(db.bones[2]))
|
||||
self.assertEquals("4: (10.00, 10.00)", self.formatBone(db.bones[3]))
|
||||
self.assertEqual(len(db.bones), 4)
|
||||
self.assertEqual("1: (10.00, 100.00)", self.formatBone(db.bones[0]))
|
||||
self.assertEqual("2: (12.00, 100.00)", self.formatBone(db.bones[1]))
|
||||
self.assertEqual("3: (12.00, 10.00)", self.formatBone(db.bones[2]))
|
||||
self.assertEqual("4: (10.00, 10.00)", self.formatBone(db.bones[3]))
|
||||
|
||||
def test02(self):
|
||||
'''Verify bones are correctly generated for a Profile.'''
|
||||
@@ -113,7 +108,7 @@ class TestDressupDogbone(PathTestBase):
|
||||
if f.Surface.Axis == FreeCAD.Vector(0,0,1) and f.Orientation == 'Forward':
|
||||
break
|
||||
|
||||
job = PathJob.Create('Job', [cut], None)
|
||||
PathJob.Create('Job', [cut], None)
|
||||
|
||||
profile = PathProfileFaces.Create('Profile Faces')
|
||||
profile.Base = (cut, face)
|
||||
@@ -138,14 +133,14 @@ class TestDressupDogbone(PathTestBase):
|
||||
return "(%.2f, %.2f)" % (pt[0], pt[1])
|
||||
|
||||
# Make sure we get 8 bones, 2 in each corner (different heights)
|
||||
self.assertEquals(len(locs), 8)
|
||||
self.assertEquals("(27.50, 27.50)", formatBoneLoc(locs[0]))
|
||||
self.assertEquals("(27.50, 27.50)", formatBoneLoc(locs[1]))
|
||||
self.assertEquals("(27.50, 72.50)", formatBoneLoc(locs[2]))
|
||||
self.assertEquals("(27.50, 72.50)", formatBoneLoc(locs[3]))
|
||||
self.assertEquals("(72.50, 27.50)", formatBoneLoc(locs[4]))
|
||||
self.assertEquals("(72.50, 27.50)", formatBoneLoc(locs[5]))
|
||||
self.assertEquals("(72.50, 72.50)", formatBoneLoc(locs[6]))
|
||||
self.assertEquals("(72.50, 72.50)", formatBoneLoc(locs[7]))
|
||||
self.assertEqual(len(locs), 8)
|
||||
self.assertEqual("(27.50, 27.50)", formatBoneLoc(locs[0]))
|
||||
self.assertEqual("(27.50, 27.50)", formatBoneLoc(locs[1]))
|
||||
self.assertEqual("(27.50, 72.50)", formatBoneLoc(locs[2]))
|
||||
self.assertEqual("(27.50, 72.50)", formatBoneLoc(locs[3]))
|
||||
self.assertEqual("(72.50, 27.50)", formatBoneLoc(locs[4]))
|
||||
self.assertEqual("(72.50, 27.50)", formatBoneLoc(locs[5]))
|
||||
self.assertEqual("(72.50, 72.50)", formatBoneLoc(locs[6]))
|
||||
self.assertEqual("(72.50, 72.50)", formatBoneLoc(locs[7]))
|
||||
|
||||
FreeCAD.closeDocument("TestDressupDogbone")
|
||||
|
||||
@@ -22,17 +22,13 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts
|
||||
import PathTests.PathTestUtils as PathTestUtils
|
||||
import math
|
||||
import unittest
|
||||
|
||||
from FreeCAD import Vector
|
||||
from PathScripts.PathDressupHoldingTags import *
|
||||
from PathTests.PathTestUtils import PathTestBase
|
||||
from PathScripts.PathDressupHoldingTags import Tag
|
||||
|
||||
class TestHoldingTags(PathTestBase):
|
||||
class TestHoldingTags(PathTestUtils.PathTestBase):
|
||||
"""Unit tests for the HoldingTags dressup."""
|
||||
|
||||
def test00(self):
|
||||
|
||||
@@ -22,13 +22,10 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import Part
|
||||
import Path
|
||||
import PathScripts
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import math
|
||||
import unittest
|
||||
|
||||
from FreeCAD import Vector
|
||||
from PathTests.PathTestUtils import PathTestBase
|
||||
@@ -238,10 +235,6 @@ class TestPathGeom(PathTestBase):
|
||||
self.assertLine(PathGeom.edgeForCmd(Path.Command('G1', {'X': 7, 'Y': 2, 'Z': 3}), spt), spt, Vector(7, 2, 3))
|
||||
self.assertLine(PathGeom.edgeForCmd(Path.Command('G01', {'X': 1, 'Y': 3, 'Z': 5}), spt), spt, Vector(1, 3, 5))
|
||||
|
||||
def test15(self):
|
||||
"""Verify proper feed rate for G1 commands is assigned."""
|
||||
pass
|
||||
|
||||
def test20(self):
|
||||
"""Verify proper geometry for arcs in the XY-plane are created."""
|
||||
p1 = Vector(0, -1, 2)
|
||||
@@ -369,7 +362,6 @@ class TestPathGeom(PathTestBase):
|
||||
e = PathGeom.arcToHelix(Part.Edge(Part.Arc(p11, p12, p13)), 2, -2)
|
||||
self.assertCurve(e, p1 + Vector(0,0,2), p2, p3 + Vector(0,0,-2))
|
||||
|
||||
o = 10*math.sin(math.pi/4)
|
||||
p1 = Vector(10, -10, 1)
|
||||
p2 = Vector(10 - 10*math.sin(math.pi/4), -10*math.cos(math.pi/4), 1)
|
||||
p3 = Vector(0, 0, 1)
|
||||
@@ -431,8 +423,6 @@ class TestPathGeom(PathTestBase):
|
||||
o = 10*math.sin(math.pi/4)
|
||||
p12 = Vector(10 - o, -o, 2.5)
|
||||
p23 = Vector(10 - o, +o, 7.5)
|
||||
pf = e[0].valueAt((e[0].FirstParameter + e[0].LastParameter)/2)
|
||||
pl = e[1].valueAt((e[1].FirstParameter + e[1].LastParameter)/2)
|
||||
self.assertCurve(e[0], p1, p12, p2)
|
||||
self.assertCurve(e[1], p2, p23, p3)
|
||||
|
||||
|
||||
@@ -35,11 +35,11 @@ class TestPathLog(unittest.TestCase):
|
||||
PathLog.untrackAllModules()
|
||||
|
||||
def callerFile(self):
|
||||
return PathLog._caller()[0]
|
||||
return PathLog._caller()[0] # pylint: disable=protected-access
|
||||
def callerLine(self):
|
||||
return PathLog._caller()[1]
|
||||
return PathLog._caller()[1] # pylint: disable=protected-access
|
||||
def callerFunc(self):
|
||||
return PathLog._caller()[2]
|
||||
return PathLog._caller()[2] # pylint: disable=protected-access
|
||||
|
||||
def test00(self):
|
||||
"""Check for proper module extraction."""
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
import FreeCAD
|
||||
import Part
|
||||
import Path
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathOpTools as PathOpTools
|
||||
import PathScripts.PathLog as PathLog
|
||||
@@ -78,7 +77,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
global doc
|
||||
global doc # pylint: disable=global-statement
|
||||
doc = FreeCAD.openDocument(FreeCAD.getHomePath() + 'Mod/Path/PathTests/test_geomop.fcstd')
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -33,6 +33,7 @@ import PathScripts.PathUtil
|
||||
import difflib
|
||||
import unittest
|
||||
|
||||
WriteDebugOutput = False
|
||||
|
||||
class PathPostTestCases(unittest.TestCase):
|
||||
|
||||
@@ -63,8 +64,8 @@ class PathPostTestCases(unittest.TestCase):
|
||||
refGCode = fp.read()
|
||||
|
||||
# Use if this test fails in order to have a real good look at the changes
|
||||
if False:
|
||||
with open('tab.tmp', 'w') as fp:
|
||||
if WriteDebugOutput:
|
||||
with open('testLinuxCNC.tmp', 'w') as fp:
|
||||
fp.write(gcode)
|
||||
|
||||
if gcode != refGCode:
|
||||
@@ -81,8 +82,8 @@ class PathPostTestCases(unittest.TestCase):
|
||||
refGCode = fp.read()
|
||||
|
||||
# Use if this test fails in order to have a real good look at the changes
|
||||
if False:
|
||||
with open('tab.tmp', 'w') as fp:
|
||||
if WriteDebugOutput:
|
||||
with open('testLinuxCNCImplerial.tmp', 'w') as fp:
|
||||
fp.write(gcode)
|
||||
|
||||
if gcode != refGCode:
|
||||
@@ -99,8 +100,8 @@ class PathPostTestCases(unittest.TestCase):
|
||||
refGCode = fp.read()
|
||||
|
||||
# Use if this test fails in order to have a real good look at the changes
|
||||
if False:
|
||||
with open('tab.tmp', 'w') as fp:
|
||||
if WriteDebugOutput:
|
||||
with open('testCentroid.tmp', 'w') as fp:
|
||||
fp.write(gcode)
|
||||
|
||||
if gcode != refGCode:
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathSetupSheet as PathSetupSheet
|
||||
import PathScripts.PathLog as PathLog
|
||||
import sys
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import Part
|
||||
import Path
|
||||
import PathScripts.PathStock as PathStock
|
||||
|
||||
from PathTests.PathTestUtils import PathTestBase
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
|
||||
from PathTests.PathTestUtils import PathTestBase
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
|
||||
from PathTests.PathTestUtils import PathTestBase
|
||||
|
||||
@@ -23,10 +23,7 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import Part
|
||||
import Path
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
import Sketcher
|
||||
import TestSketcherApp
|
||||
|
||||
from PathTests.PathTestUtils import PathTestBase
|
||||
|
||||
@@ -57,6 +57,7 @@ EXTERNAL_MODULES+=' PySide'
|
||||
EXTERNAL_MODULES+=' PySide.QtCore'
|
||||
EXTERNAL_MODULES+=' PySide.QtGui'
|
||||
EXTERNAL_MODULES+=' TechDraw'
|
||||
EXTERNAL_MODULES+=' TestSketcherApp'
|
||||
EXTERNAL_MODULES+=' area'
|
||||
EXTERNAL_MODULES+=' importlib'
|
||||
EXTERNAL_MODULES+=' ocl'
|
||||
@@ -79,6 +80,7 @@ if [ -z "$(which pylint3)" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#pylint3 ${ARGS} PathScripts/ PathTests/
|
||||
pylint3 ${ARGS} PathScripts/
|
||||
pylint3 ${ARGS} PathScripts/ PathTests/
|
||||
#pylint3 ${ARGS} PathScripts/
|
||||
#pylint3 ${ARGS} PathTests/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user