
sudo pip install Pythoscope  sudo apt-get install bzr bzr branch lp:pythoscope cd pythoscope/ python setup.py install 
 # cat.py class Cat(object): def __init__(self, name='Tom'): self.name = name def eat(self, food): if food == 'fish': return 'Yummy!' else: return 'Ugh!'  pythoscope --init  pythoscope cat.py  # tests/cat_test.py import unittest class TestCat(unittest.TestCase): def test___init__(self): # cat = Cat(name) assert False # TODO: implement your test here def test_eat(self): # cat = Cat(name) # self.assertEqual(expected, cat.eat(food)) assert False # TODO: implement your test here if __name__ == '__main__': unittest.main()  # .pythoscope/points-of-entry/eat_fish_poe.py from cat import Cat Cat().eat('fish')  pythoscope cat.py  # tests/cat_test.py ... def test_eat_returns_Yummy_for_fish_after_creation_with_Tom(self): cat = Cat('Tom') self.assertEqual('Yummy!', cat.eat('fish')) ...  # .pythoscope/points-of-entry/eat_tomato_poe.py from cat import Cat Cat().eat('tomato')  pythoscope cat.py  nosetests .. ---------------------------------------------------------------------- Ran 2 tests in 0.001s OK Source: https://habr.com/ru/post/192512/
All Articles