mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-30 02:46:52 +00:00
A slow start towards rewriting the tests
This commit is contained in:
parent
1e59072600
commit
d3b8f9a284
1 changed files with 15 additions and 2 deletions
|
|
@ -1,8 +1,21 @@
|
|||
from flake8 import engine
|
||||
import unittest
|
||||
import mock
|
||||
|
||||
|
||||
class TestEngine(unittest.TestCase):
|
||||
def test_get_style_guide(self):
|
||||
g = engine.get_style_guide()
|
||||
self.assertTrue(isinstance(g, engine.StyleGuide))
|
||||
with mock.patch('flake8.engine._register_extensions') as reg_ext:
|
||||
reg_ext.return_value = ([], [], [])
|
||||
g = engine.get_style_guide()
|
||||
self.assertTrue(isinstance(g, engine.StyleGuide))
|
||||
reg_ext.assert_called_once_with()
|
||||
|
||||
def test_get_style_guide_kwargs(self):
|
||||
m = mock.Mock()
|
||||
with mock.patch('flake8.engine.StyleGuide') as StyleGuide:
|
||||
with mock.patch('flake8.engine.get_parser') as get_parser:
|
||||
get_parser.return_value = (m, [])
|
||||
engine.get_style_guide(foo='bar')
|
||||
get_parser.assert_called_once_with()
|
||||
StyleGuide.assert_called_once_with(**{'parser': m, 'foo': 'bar'})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue