Skip to content

Commit 86d20c0

Browse files
authored
Modify generate method to return a formatted string
Changed the return type of the generate method to str and updated its implementation to return a formatted string instead of printing it.
1 parent c853554 commit 86d20c0

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

geometry/braik_mac_construction.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __post_init__(self) -> None:
6767
raise TypeError("Array must be 5 point objects.")
6868

6969
@property
70-
def generate(self) -> None:
70+
def generate(self) -> str:
7171
x1 = self.p_list[0].x
7272
y1 = self.p_list[0].y
7373
x2 = self.p_list[1].x
@@ -151,5 +151,10 @@ def generate(self) -> None:
151151

152152
f = -linalg.det(const_matrix)
153153

154-
s = f"0 = {a:+.2} X**2 {b:+.2} XY {c:+.2} Y**2 {d:+.2} X {e:+.2} Y {f:+.2}"
155-
print(s)
154+
return f"0 = {a:+.2} X**2 {b:+.2} XY {c:+.2} Y**2 {d:+.2} X {e:+.2} Y {f:+.2}"
155+
156+
157+
if __name__ == +__main__":
158+
from doctest import testmod
159+
160+
testmod()

0 commit comments

Comments
 (0)