Skip to content

Commit 7708336

Browse files
author
Khamid Tomov
committed
Merge pull request gregmalcolm#1 from gregmalcolm/master
sync
2 parents 8641d7c + c9e842e commit 7708336

27 files changed

Lines changed: 73 additions & 71 deletions

python2/contemplate_koans.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,26 @@
1010
# So thank guys!
1111
#
1212

13-
import unittest
1413
import sys
1514

1615

1716
if __name__ == '__main__':
1817
if sys.version_info >= (3, 0):
1918
print("\nThis is the Python 2 version of Python Koans, but you are " +
20-
"running it with Python 3 or newer!\n\n"
21-
"Did you accidentally use the wrong python script? \nTry:\n\n" +
22-
" python contemplate_koans.py\n")
19+
"running it with Python 3 or newer!\n\n"
20+
"Did you accidentally use the wrong python script? \nTry:\n\n" +
21+
" python contemplate_koans.py\n")
2322
else:
2423
if sys.version_info < (2, 7):
2524
print("\n" +
26-
"********************************************************\n" +
27-
"WARNING:\n" +
28-
"This version of Python Koans was designed for " +
29-
"Python 2.7 or greater.\n" +
30-
"Your version of Python is older, so you may run into " +
31-
"problems!\n\n" +
32-
"But lets see how far we get...\n" +
33-
"********************************************************\n")
25+
"********************************************************\n" +
26+
"WARNING:\n" +
27+
"This version of Python Koans was designed for " +
28+
"Python 2.7 or greater.\n" +
29+
"Your version of Python is older, so you may run into " +
30+
"problems!\n\n" +
31+
"But lets see how far we get...\n" +
32+
"********************************************************\n")
3433

3534
from runner.mountain import Mountain
3635

python2/koans/about_class_attributes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Dog(object):
1414

1515
def test_new_style_class_objects_are_objects(self):
1616
# Note: Old style class instances are not objects but they are being
17-
# phased out it Python 3.
17+
# phased out in Python 3.
1818

1919
fido = self.Dog()
2020
self.assertEqual(__, isinstance(fido, object))

python2/koans/about_classes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def test_args_must_match_init(self):
109109
# THINK ABOUT IT:
110110
# Why is this so?
111111

112-
def test_different_objects_have_difference_instance_variables(self):
112+
def test_different_objects_have_different_instance_variables(self):
113113
fido = self.Dog5("Fido")
114114
rover = self.Dog5("Rover")
115115

python2/koans/about_control_statements.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ def test_if_then_statements(self):
1818
if True:
1919
result = 'true value'
2020
self.assertEqual(__, result)
21+
22+
def test_if_then_elif_else_statements(self):
23+
if False:
24+
result = 'first value'
25+
elif True:
26+
result = 'true value'
27+
else:
28+
result = 'default value'
29+
self.assertEqual(__, result)
2130

2231
def test_while_statement(self):
2332
i = 1

python2/koans/about_deleting_objects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

44
from runner.koan import *

python2/koans/about_iteration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def test_use_pass_for_iterations_with_no_body(self):
9494
# ------------------------------------------------------------------
9595

9696
def test_all_iteration_methods_work_on_any_sequence_not_just_lists(self):
97-
# Ranges are an iteratable sequence
97+
# Ranges are an iterable sequence
9898
result = map(self.add_ten, range(1, 4))
9999
self.assertEqual(__, list(result))
100100

python2/koans/about_packages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_use_absolute_imports_to_import_upper_level_modules(self):
5656
# contemplate_koans.py is the root module in this package because its
5757
# the first python module called in koans.
5858
#
59-
# If contemplate_koan.py was based in a_package_folder that would be
59+
# If contemplate_koans.py was based in a_package_folder that would be
6060
# the root folder, which would make reaching the koans folder
6161
# almost impossible. So always leave the starting python script in
6262
# a folder which can reach everything else.

python2/koans/about_proxy_object_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# missing handler and any other supporting methods. The specification
1414
# of the Proxy class is given in the AboutProxyObjectProject koan.
1515

16-
# Note: This is a bit trickier that its Ruby Koans counterpart, but you
16+
# Note: This is a bit trickier than its Ruby Koans counterpart, but you
1717
# can do it!
1818

1919
from runner.koan import *

python2/koans/about_regex.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_matching_literal_text_how_many(self):
3030
"""
3131
Lesson 1 -- How many matches?
3232
33-
The default behaviour of most regular extression engines is
33+
The default behaviour of most regular expression engines is
3434
to return just the first match. In python you have the
3535
following options:
3636
@@ -63,8 +63,8 @@ def test_matching_literal_text_not_case_sensitivity(self):
6363
string = "Hello, my name is Felix or felix and this koan " + \
6464
"is based on Ben's book: Regular Expressions in 10 minutes."
6565

66-
self.assertEqual(re.findall("felix", string, 20), __)
67-
self.assertEqual(re.findall("felix", string, 10), __)
66+
self.assertEqual(re.findall("felix", string), __)
67+
self.assertEqual(re.findall("felix", string, re.IGNORECASE), __)
6868

6969
def test_matching_any_character(self):
7070
"""

python2/koans/about_triangle_project2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ def test_illegal_triangles_throw_exceptions(self):
1616

1717
self.assertRaises(TriangleError, triangle, 3, 4, -5)
1818
self.assertRaises(TriangleError, triangle, 1, 1, 3)
19-
self.assertRaises(TriangleError, triangle, 2, 4, 2)
19+
self.assertRaises(TriangleError, triangle, 2, 5, 2)

0 commit comments

Comments
 (0)