예제 #1
0
# import geometry as g
# import modules.geometry as g

import modules.geometry as g

import sys
sys.path.append("modules")  # 模組path 中,新增路徑


print(sys.platform)
print(sys.maxsize)  # 系統最長的整數形態最大值

# 建立geometry模組,載入使用
# 算2點距離
print(g.distance(1, 1, 5, 5))
# 算斜率
print(g.slope(1, 2, 5, 6))

# 調整搜尋模組的路徑
print(sys.path)  # 印出模組的搜尋路徑,所以才能找到 geometry module
예제 #2
0
 def test_slope_neg6_6(self):
     slope = geo.slope([8, 2], [2, 8])
     self.assertEqual([-6, 6], slope, "Incorrect slope value")
예제 #3
0
 def test_slope_data_type(self):
     slope = geo.slope([-4, 9], [6, -5])
     slopeType = type(slope) == list
     self.assertTrue(slopeType, "This is not a list type!")
예제 #4
0
 def test_slope_negative_odds_133296(self):
     slope = geo.slope([-13, -3], [-29, -6])
     self.assertEqual([-16, -3], slope, "Incorrect slope value")
예제 #5
0
 def test_slope_positive_odds_7931(self):
     slope = geo.slope([7, 9], [3, 1])
     self.assertEqual([-4, -8], slope, "Incorrect slope value")
예제 #6
0
 def test_slope_10_neg14(self):
     slope = geo.slope([-4, 9], [6, -5])
     self.assertEqual([10, -14], slope, "Incorrect slope value")