Skip to content

Commit bdd0cf0

Browse files
committedJun 22, 2017
Update import statements and modify test and challenge files to accommodate those updated import statements
1 parent cfd601c commit bdd0cf0

File tree

36 files changed

+47
-95
lines changed

36 files changed

+47
-95
lines changed
 

‎challenges/1.3.Input/lesson_tests.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class InputTests(unittest.TestCase):
55
def test_main(self):
6-
name = lesson_code.Name
7-
age = lesson_code.Age
8-
96
self.assertIsInstance(name, str)
107
self.assertIsInstance(age, str)
118
# To run the tests from the console:
+1-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class NumbersTests(unittest.TestCase):
55
def test_main(self):
6-
myInteger = lesson_code.myInteger
7-
myFloat = lesson_code.myFloat
8-
myComplex = lesson_code.myComplex
96
self.assertIsInstance(myInteger, int)
107
self.assertIsInstance(myFloat, float)
118
self.assertIsInstance(myComplex, complex)

‎challenges/2.2.Strings/lesson_tests.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class StringsTests(unittest.TestCase):
55
def test_main(self):
6-
myName = lesson_code.myName
7-
myAge = lesson_code.myAge
8-
favoriteActivity = lesson_code.favoriteActivity
9-
mySentence = lesson_code.mySentence
106
self.assertIsInstance(myName, str)
117
self.assertIsInstance(myAge, str)
128
self.assertIsInstance(favoriteActivity, str)

‎challenges/2.3.Tuples/lesson_tests.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class StringsTests(unittest.TestCase):
55
def test_main(self):
6-
twoTuple = lesson_code.twoTuple
7-
threeTuple = lesson_code.threeTuple
8-
fiveTuple = lesson_code.fiveTuple
9-
tenTuple = lesson_code.tenTuple
106
self.assertIsInstance(twoTuple, tuple)
117
self.assertIsInstance(threeTuple, tuple)
128
self.assertIsInstance(fiveTuple, tuple)
@@ -15,4 +11,3 @@ def test_main(self):
1511
self.assertEqual(len(threeTuple), 3)
1612
self.assertEqual(len(fiveTuple), 5)
1713
self.assertEqual(len(tenTuple), 10)
18-

‎challenges/2.4.Lists/lesson_tests.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class StringsTests(unittest.TestCase):
55
def test_main(self):
6-
mediumList = lesson_code.mediumList
7-
shortList = lesson_code.shortList
8-
longList = lesson_code.longList
9-
106
self.assertIsInstance(mediumList, list)
117
self.assertIsInstance(shortList, list)
128
self.assertIsInstance(longList, list)
13-
149
self.assertEqual(len(mediumList), 5)
1510
self.assertEqual(len(shortList), 2)
1611
self.assertEqual(len(longList), 7)

‎challenges/2.5.Sets/lesson_tests.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class StringsTests(unittest.TestCase):
55
def test_main(self):
6-
fccSet = lesson_code.fccSet
7-
86
self.assertIsInstance(fccSet, set)
97
self.assertEqual(len(fccSet), 14)
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class AssignmentOperatorTests(unittest.TestCase):
55
def test_main(self):
6-
my_name = lesson_code.my_name
76
self.assertIsNotNone(my_name)
87
self.assertIsInstance(my_name, str)
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import unittest
2-
from lesson_code import equality
2+
from main import *
33

44
class EqualityOperatorTests(unittest.TestCase):
55
def test_main(self):
@@ -9,7 +9,7 @@ def test_main(self):
99
self.assertNotEqual(equality(12), 'Not Equal to 12')
1010

1111
def test_operator_presence(self):
12-
f = open('lesson_code.py')
12+
f = open('main.py')
1313
lines = str(f.readlines())
1414
f.close()
1515
self.assertRegex(lines, '==', msg="The == operator is not in the function definition")
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import unittest
2-
from inequality_operator_code import inequality
2+
from main import *
33

44
class InEqualityOperatorTests(unittest.TestCase):
55
def test_main(self):
@@ -9,7 +9,7 @@ def test_main(self):
99
self.assertNotEqual(inequality(13), 'Not Equal to 13')
1010

1111
def test_operator_presence(self):
12-
f = open('inequality_operator_code.py')
12+
f = open('main.py')
1313
lines = str(f.readlines())
1414
f.close()
1515
self.assertRegex(lines, '!=', msg="The != operator is not in the function definition")

‎challenges/3.4.Strictly_Less_Than_Operator/lesson_tests.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import unittest
2-
from lesson_code import strictly_less_than
2+
from main import *
33

44
class StrictlyLessThanOperatorTests(unittest.TestCase):
55
def test_main(self):
@@ -13,7 +13,7 @@ def test_main(self):
1313
self.assertEqual(strictly_less_than(110), "100 or more")
1414

1515
def test_operator_presence(self):
16-
f = open('lesson_code.py')
16+
f = open('main.py')
1717
lines = str(f.readlines())
1818
f.close()
1919
self.assertRegex(lines, '<', msg="The < operator is not in the function definition")

‎challenges/3.5.Less_Than_Equal_To_Operator/lesson_tests.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import unittest
2-
from lesson_code import less_or_equal
2+
from main import *
33

44
class GreaterThanEqualToOperatorTests(unittest.TestCase):
55
def test_main(self):
@@ -13,7 +13,7 @@ def test_main(self):
1313
self.assertEqual(less_or_equal(100), "More than 75")
1414

1515
def test_operator_presence(self):
16-
f = open('lesson_code.py')
16+
f = open('main.py')
1717
lines = str(f.readlines())
1818
f.close()
1919
self.assertRegex(lines, '<=', msg="The <= operator is not in the function definition")

‎challenges/3.6.Greater_Than_Equal_To_Operator/lesson_tests.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import unittest
2-
from lesson_code import greater_or_equal
2+
from main import *
33

44
class GreaterThanEqualToOperatorTests(unittest.TestCase):
55
def test_main(self):
@@ -13,7 +13,7 @@ def test_main(self):
1313
self.assertEqual(greater_or_equal(51), "50 or more")
1414

1515
def test_operator_presence(self):
16-
f = open('lesson_code.py')
16+
f = open('main.py')
1717
lines = str(f.readlines())
1818
f.close()
1919
self.assertRegex(lines, '>=', msg="The >= operator is not in the function definition")

‎challenges/3.7.Strictly_Greater_Than_Operator/lesson_tests.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import unittest
2-
from lesson_code import strictly_greater_than
2+
from main import *
33

44
class StrictlyGreaterThanOperatorTests(unittest.TestCase):
55
def test_main(self):
@@ -14,7 +14,7 @@ def test_main(self):
1414
self.assertEqual(strictly_greater_than(111), "Greater than 100")
1515

1616
def test_operator_presence(self):
17-
f = open('lesson_code.py')
17+
f = open('main.py')
1818
lines = str(f.readlines())
1919
f.close()
2020
self.assertRegex(lines, '>', msg="The > operator is not in the function definition")

‎challenges/3.8.False_Operator/lesson_tests.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import unittest
2-
import lesson_code
3-
from lesson_code import boolean_false
2+
from main import *
43

54
class BooleanFalseKeywordTests(unittest.TestCase):
65
def test_main(self):

‎challenges/3.9.True_Operator/lesson_tests.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import unittest
2-
import lesson_code
3-
from lesson_code import boolean_true
2+
from main import *
43

54
class BooleanTrueKeywordTests(unittest.TestCase):
65
def test_main(self):

‎challenges/3.A.Logical_And_Operator/lesson_tests.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import unittest
2-
import lesson_code
3-
from lesson_code import boolean_and
2+
from main import *
43

54
class BooleanAndOperatorTests(unittest.TestCase):
65
def test_main(self):

‎challenges/3.B.Logical_Not_Operator/lesson_tests.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import unittest
2-
import lesson_code
3-
from lesson_code import boolean_not
2+
from main import *
43

54
class BooleanNotOperatorTests(unittest.TestCase):
65
def test_main(self):

‎challenges/3.C.Logical_Or_Operator/lesson_tests.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import unittest
2-
import lesson_code
3-
from lesson_code import boolean_or
2+
from main import *
43

54
class BooleanOrOperatorTests(unittest.TestCase):
65
def test_main(self):

‎challenges/3.D.Is_Operator/lesson_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import unittest
2-
from lesson_code import identity_test
2+
from main import *
33

44
class IdentityOperatorTests(unittest.TestCase):
55
def test_main(self):

‎challenges/3.E.Is_Not_Operator/lesson_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import unittest
2-
from lesson_code import negative_identity_test
2+
from main import *
33

44
class NegativeIdentityOperatorTests(unittest.TestCase):
55
def test_main(self):

‎challenges/3.F.In_Operator/lesson_tests.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import unittest
2-
import lesson_code
3-
from lesson_code import membership_test
2+
from main import *
43

54
class TestMembership(unittest.TestCase):
65
def test_main(self):
7-
word = lesson_code.word
8-
sentence = lesson_code.sentence
96
self.assertIsNotNone(membership_test())
107
self.assertEqual(membership_test(), True)
118
self.assertTrue(membership_test())

‎challenges/3.G.Not_In_Operator/lesson_tests.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import unittest
2-
import lesson_code
3-
from lesson_code import non_membership_test
2+
from main import *
43

54
class TestNonMembership(unittest.TestCase):
65
def test_main(self):
7-
letter = lesson_code.letter
8-
alphabet = lesson_code.alphabet
96
self.assertIsNotNone(non_membership_test())
107
self.assertEqual(non_membership_test(), True)
118
self.assertTrue(non_membership_test())

‎challenges/4.1.Addition/lesson_tests.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class AdditionTests(unittest.TestCase):
55
def test_main(self):
6-
total = lesson_code.total
76
self.assertIsInstance(total, int)
87
self.assertEqual(total, 20)
98

‎challenges/4.2.Subtraction/lesson_tests.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class SubtractionTests(unittest.TestCase):
55
def test_main(self):
6-
total = lesson_code.total
76
self.assertIsInstance(total, int)
87
self.assertEqual(total, 10)
98

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class MultiplicationTests(unittest.TestCase):
55
def test_main(self):
6-
product = lesson_code.product
76
self.assertIsInstance(product, int)
87
self.assertEqual(product, 80)
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class FloatDivisionTests(unittest.TestCase):
55
def test_main(self):
6-
quotient = lesson_code.quotient
76
self.assertIsInstance(quotient, float)
87
self.assertEqual(quotient, 2.5)
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class IntegerDivisionTests(unittest.TestCase):
55
def test_main(self):
6-
quotient = lesson_code.quotient
76
self.assertIsInstance(quotient, int)
87
self.assertEqual(quotient, 2)
+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class ExponentsTests(unittest.TestCase):
5-
def test_main(self):
6-
power = lesson_code.power
5+
def test_main(self):
76
self.assertIsInstance(power, int)
87
self.assertEqual(power, 81)
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class RemainderTests(unittest.TestCase):
55
def test_main(self):
6-
remainder = lesson_code.remainder
76
self.assertIsInstance(remainder, int)
87
self.assertEqual(remainder, 2)

‎challenges/4.8.Divmod/lesson_tests.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class DivmodTests(unittest.TestCase):
55
def test_main(self):
6-
result = lesson_code.result
76
self.assertIsInstance(result, tuple)
87
self.assertEqual(result, (3, 2))
+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class SquareRootTests(unittest.TestCase):
5-
def test_main(self):
6-
square_root = lesson_code.square_root
5+
def test_main(self):
76
self.assertIsInstance(square_root, float)
87
self.assertEqual(square_root, 9.0)

‎challenges/4.A.Sum/lesson_tests.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class SumTests(unittest.TestCase):
5-
def test_main(self):
6-
total = lesson_code.total
5+
def test_main(self):
76
self.assertIsInstance(total, int)
87
self.assertEqual(total, 55)
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class RoundingTests(unittest.TestCase):
55
def test_main(self):
6-
shorter_pi = lesson_code.shorter_pi
76
self.assertIsInstance(shorter_pi, float)
87
self.assertEqual(shorter_pi, 3.14)
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class AbsoluteValueTests(unittest.TestCase):
5-
def test_main(self):
6-
absolute_value = lesson_code.absolute_value
5+
def test_main(self):
76
self.assertIsInstance(absolute_value, int)
87
self.assertEqual(absolute_value, 42)
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class MinValueTests(unittest.TestCase):
55
def test_main(self):
6-
lowest = lesson_code.lowest
76
self.assertIsInstance(lowest, int)
87
self.assertEqual(lowest, 1)
+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import unittest
2-
import lesson_code
2+
from main import *
33

44
class MaxValueTests(unittest.TestCase):
5-
def test_main(self):
6-
highest = lesson_code.highest
5+
def test_main(self):
76
self.assertIsInstance(highest, int)
87
self.assertEqual(highest, 9)

0 commit comments

Comments
 (0)
Please sign in to comment.