nnoremap <C-p> :!python %<CR>
unittest
import unittest
#(Omission)
if __name__ == '__main__':
unittest.main()
Des tests
class PythonTest(unittest.TestCase):
def test_zero(self):
self.assertEqual(0, 0)
def test_foo(self):
self.assertEqual("foo", "foo")
def test_bar(self):
self.assertEqual("foo", "foo")
sample
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'Fonctions d'évaluation'
def evaluate(value):
"""Fonction pour revenir tel quel"""
return value
import unittest
class EvaluateTest(unittest.TestCase):
def test_evaluate(self):
value = 1
evaluated_value = evaluate(value)
self.assertEqual(value,evaluated_value)
if __name__ == '__main__':
unittest.main()
Recommended Posts