Skip to content

Commit

Permalink
Changed homework for week 3
Browse files Browse the repository at this point in the history
  • Loading branch information
YAtOff committed Nov 24, 2016
1 parent e5a1985 commit 96ef71a
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 158 deletions.
150 changes: 0 additions & 150 deletions week3/Strings.ipynb

This file was deleted.

5 changes: 5 additions & 0 deletions week3/homework/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Как да проверя домашното?

1. Изтегли всички файлове.
2. Напиш домашното.
3. Стартирай файла `tests.py`
28 changes: 28 additions & 0 deletions week3/homework/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import unittest
import logging

def warn_if_not_implemented(func):
def wrapper(*args, **kwargs):
try:
func(*args, **kwargs)
except Exception as e:
if e.args[0] == 'Not implemented':
logging.warning('%s is not implemented' % func.__name__[len('test_'):])
return
raise

return wrapper


class TestTasks(unittest.TestCase):

@warn_if_not_implemented
def test_xor(self):
from xor import xor
self.assertEqual(xor(False, False), False)
self.assertEqual(xor(False, True), True)
self.assertEqual(xor(True, False), True)
self.assertEqual(xor(True, True), False)

if __name__ == '__main__':
unittest.main()
File renamed without changes.
8 changes: 0 additions & 8 deletions week4/tasks/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ def wrapper(*args, **kwargs):

class TestTasks(unittest.TestCase):

@warn_if_not_implemented
def test_xor(self):
from xor import xor
self.assertEqual(xor(False, False), True)
self.assertEqual(xor(False, True), False)
self.assertEqual(xor(True, False), False)
self.assertEqual(xor(True, True), True)

@warn_if_not_implemented
def test_compare(self):
from compare import compare
Expand Down

0 comments on commit 96ef71a

Please sign in to comment.