Skip to content

Commit 42101ae

Browse files
author
Jessica Yung
committed
test: add sample unit test and function, write test (buggy) for p2.
- chore: change file names to match Python style guide (change dashes to underscores) ISSUE: p2 tests buggy. I deliberately included assertEquals(0, 1) so it should throw an assertion error but it's not running any of the tests.
1 parent bec17ee commit 42101ae

8 files changed

+23
-228
lines changed

mathematics/project-euler/1-multiples-of-three-and-five.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

mathematics/project-euler/2-even-fibonacci-numbers.py

Lines changed: 0 additions & 45 deletions
This file was deleted.

mathematics/project-euler/3-largest-prime-factor.py

Lines changed: 0 additions & 45 deletions
This file was deleted.

mathematics/project-euler/4-largest-palindrome-product.py

Lines changed: 0 additions & 50 deletions
This file was deleted.

mathematics/project-euler/5-smallest-multiple.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

mathematics/project-euler/6-sum-square-difference.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

mathematics/project-euler/7-nth-prime.py

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
A simple function and a unit test to go with it.
3+
Have tested that this returns no errors with the uncommented tests and that
4+
it returns an AssertionError when the commented (deliberately false) test is included.
5+
6+
"""
7+
8+
import unittest
9+
10+
def square_x(x):
11+
"""Square X."""
12+
return x**2
13+
14+
class Tests(unittest.TestCase):
15+
"""Unit test for `square_x` function."""
16+
17+
def test_square_x(self):
18+
self.assertEqual(square_x(4), 16)
19+
self.assertEqual(square_x(10), 100)
20+
# self.assertEqual(square_x(1), -1)
21+
22+
if __name__ == '__main__':
23+
unittest.main()

0 commit comments

Comments
 (0)