From 094b8e612592a80b7392d600050a34b423b1ae2a Mon Sep 17 00:00:00 2001 From: Koshetarov <40320320+Koshetarov@users.noreply.github.com> Date: Wed, 20 Jun 2018 12:19:36 +0500 Subject: [PATCH 1/5] test1 --- homework/tests.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/homework/tests.py b/homework/tests.py index 90a295b..5df2d0d 100644 --- a/homework/tests.py +++ b/homework/tests.py @@ -5,7 +5,8 @@ def test_even_fucntion(): """ def even_filter(*args): - pass + even_filter = [x for x in args if x % 2 == 0] + return even_filter assert even_filter(1, 2, 3, 4, 5, 6) == [2, 4, 6] @@ -16,7 +17,10 @@ def test_increment_decorator(): декрорируемую функцию. """ def increment_derocator(func): - pass + def wrapper(value): + value += 1 + return func (value) + return wrapper @increment_derocator def returner(value): From 491e19a2d86e34a3e4d2943b00b32c76f42d767b Mon Sep 17 00:00:00 2001 From: Koshetarov <40320320+Koshetarov@users.noreply.github.com> Date: Thu, 21 Jun 2018 20:50:18 +0500 Subject: [PATCH 2/5] Update tests.py --- homework/tests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homework/tests.py b/homework/tests.py index 5df2d0d..c78026f 100644 --- a/homework/tests.py +++ b/homework/tests.py @@ -45,10 +45,12 @@ def __init__(self, x, y): class Segment(): def __init__(self, p1, p2): - pass + self.p1 = p1 + self.p2 = p2 def length(self): - return 0 + value = math.sqrt(math.pow(self.p1.x - self.p2.x, 2) + math.pow(self.p1.y - self.p2.y, 2)) + return value p1 = Point(0, 0) p2 = Point(3, 4) From 93a7ed8f4ce77e511617c101eedb6007bcacf259 Mon Sep 17 00:00:00 2001 From: Koshetarov <40320320+Koshetarov@users.noreply.github.com> Date: Thu, 21 Jun 2018 20:52:15 +0500 Subject: [PATCH 3/5] test2 --- homework/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homework/tests.py b/homework/tests.py index c78026f..e915ef0 100644 --- a/homework/tests.py +++ b/homework/tests.py @@ -28,7 +28,7 @@ def returner(value): assert returner(1) == 2 - +import math def test_point_segment_class(): """ Дано: есть класс Point, описывающий точку на плоскости. Необходимо закончить класс Segment, описывающий отрезок, From 68d4f5c41b5c7908a46500c940a37557330fdfca Mon Sep 17 00:00:00 2001 From: Koshetarov <40320320+Koshetarov@users.noreply.github.com> Date: Thu, 21 Jun 2018 21:17:57 +0500 Subject: [PATCH 4/5] test2 --- homework/tests.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/homework/tests.py b/homework/tests.py index e915ef0..8fa46a2 100644 --- a/homework/tests.py +++ b/homework/tests.py @@ -5,8 +5,11 @@ def test_even_fucntion(): """ def even_filter(*args): - even_filter = [x for x in args if x % 2 == 0] - return even_filter + + result = [] ++ for i in args: ++ if i % 2 == 0: ++ result.append(i) + return result assert even_filter(1, 2, 3, 4, 5, 6) == [2, 4, 6] @@ -17,10 +20,9 @@ def test_increment_decorator(): декрорируемую функцию. """ def increment_derocator(func): - def wrapper(value): - value += 1 - return func (value) - return wrapper + def wrapper(value): ++ return func(value + 1) ++ return wrapper @increment_derocator def returner(value): @@ -29,6 +31,7 @@ def returner(value): assert returner(1) == 2 import math + def test_point_segment_class(): """ Дано: есть класс Point, описывающий точку на плоскости. Необходимо закончить класс Segment, описывающий отрезок, From 54e603d47931b23b3be293dc4b6cd58e4002d4c7 Mon Sep 17 00:00:00 2001 From: Koshetarov <40320320+Koshetarov@users.noreply.github.com> Date: Fri, 22 Jun 2018 23:13:43 +0500 Subject: [PATCH 5/5] Update tests.py --- homework/tests.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/homework/tests.py b/homework/tests.py index 8fa46a2..02c0d00 100644 --- a/homework/tests.py +++ b/homework/tests.py @@ -5,12 +5,13 @@ def test_even_fucntion(): """ def even_filter(*args): - + result = [] -+ for i in args: -+ if i % 2 == 0: -+ result.append(i) - return result + result = [] + for i in args: + if i % 2 == 0: + result.append(i) + return result + assert even_filter(1, 2, 3, 4, 5, 6) == [2, 4, 6] @@ -21,8 +22,8 @@ def test_increment_decorator(): """ def increment_derocator(func): def wrapper(value): -+ return func(value + 1) -+ return wrapper + return func(value + 1) + return wrapper @increment_derocator def returner(value):