From 734f1d2b5810e8734c20f5feeb93b648f9db0b35 Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Sun, 8 Dec 2024 20:52:20 -0800 Subject: [PATCH] Diophantine Equation --- kyu_5/diophantine_equation/__init__.py | 1 + kyu_5/diophantine_equation/solution.py | 7 ++++++- kyu_5/diophantine_equation/test_solution.py | 19 +++++++++++-------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/kyu_5/diophantine_equation/__init__.py b/kyu_5/diophantine_equation/__init__.py index e69de29bb2d..c37009fd411 100644 --- a/kyu_5/diophantine_equation/__init__.py +++ b/kyu_5/diophantine_equation/__init__.py @@ -0,0 +1 @@ +"""Diophantine Equation.""" diff --git a/kyu_5/diophantine_equation/solution.py b/kyu_5/diophantine_equation/solution.py index 28da02f352d..b3d0ff728be 100644 --- a/kyu_5/diophantine_equation/solution.py +++ b/kyu_5/diophantine_equation/solution.py @@ -1,5 +1,6 @@ """ -Solution for -> Diophantine Equation +Solution for -> Diophantine Equation. + Created by Egor Kostan. GitHub: https://github.com/ikostan """ @@ -7,8 +8,12 @@ def sol_equa(n: int) -> list: """ + Diophantine Equation solution. + Finds all integers x, y (x >= 0, y >= 0) solutions of a diophantine equation of the form x2 - 4 * y2 = n + :param n: int + :return: list """ result: list = [] diff --git a/kyu_5/diophantine_equation/test_solution.py b/kyu_5/diophantine_equation/test_solution.py index 28814cfc4f4..c3d4577021e 100644 --- a/kyu_5/diophantine_equation/test_solution.py +++ b/kyu_5/diophantine_equation/test_solution.py @@ -1,5 +1,6 @@ """ -Test for -> Diophantine Equation +Test for -> Diophantine Equation. + Created by Egor Kostan. GitHub: https://github.com/ikostan """ @@ -27,13 +28,12 @@ name='Source/Kata') @pytest.mark.skip(reason="The solution is not ready") class SolutionTestCase(unittest.TestCase): - """ - Testing sol_equa function - """ + """Testing sol_equa function.""" def test_solution_basic(self): """ - Testing using basic test data + Testing using basic test data. + :return: """ self.assertEqual(sol_equa(5), [[3, 1]]) @@ -45,7 +45,8 @@ def test_solution_basic(self): def test_solution_medium(self): """ - Testing using medium test data + Testing using medium test data. + :return: """ self.assertEqual(sol_equa(9001), [[4501, 2250]]) @@ -69,7 +70,8 @@ def test_solution_medium(self): def test_solution_big(self): """ - Testing using big test data + Testing using big test data. + :return: """ self.assertEqual(sol_equa(900000), [[112502, 56249], @@ -107,7 +109,8 @@ def test_solution_big(self): def test_solution_empty(self): """ - Testing using empty test data + Testing using empty test data. + :return: """ self.assertEqual(sol_equa(90002), [])