This commit is contained in:
9
drone_test/__main__.py
Normal file
9
drone_test/__main__.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
"""Python module to test drone builds"""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from _circle_area import circle_area
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
for arg in sys.argv[1:]:
|
||||||
|
print(circle_area(float(arg)))
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
"""Python module to test drone builds"""
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
def circle_area(radius: float):
|
def circle_area(radius: float):
|
||||||
@@ -9,7 +7,7 @@ def circle_area(radius: float):
|
|||||||
:raises ValueError: radius is negative
|
:raises ValueError: radius is negative
|
||||||
:return: area of the circle
|
:return: area of the circle
|
||||||
"""
|
"""
|
||||||
if radius < 0:
|
#if radius < 0:
|
||||||
raise ValueError("Circle can't have negative radius")
|
#raise ValueError("Circle can't have negative radius")
|
||||||
|
|
||||||
return math.pi * radius ** 2
|
return math.pi * radius ** 2
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
import math
|
import math
|
||||||
|
|
||||||
from drone_test import circle_area
|
from drone_test._circle_area import circle_area
|
||||||
|
|
||||||
class CircleAreaTest(TestCase):
|
class CircleAreaTest(TestCase):
|
||||||
def test_area_1(self):
|
def test_area_1(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user