move TokenParser test to dependencies test file
This commit is contained in:
parent
fc203d3991
commit
350fc8cc0a
2 changed files with 12 additions and 12 deletions
|
@ -8,6 +8,8 @@ import os
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
from wakatime.compat import u
|
from wakatime.compat import u
|
||||||
|
from wakatime.exceptions import NotYetImplemented
|
||||||
|
from wakatime.languages import TokenParser
|
||||||
from wakatime.packages.requests.models import Response
|
from wakatime.packages.requests.models import Response
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
|
@ -31,6 +33,16 @@ class LanguagesTestCase(utils.TestCase):
|
||||||
['wakatime.session_cache.SessionCache.get', requests.session],
|
['wakatime.session_cache.SessionCache.get', requests.session],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def test_token_parser(self):
|
||||||
|
with utils.mock.patch('wakatime.languages.TokenParser._extract_tokens') as mock_extract_tokens:
|
||||||
|
|
||||||
|
with self.assertRaises(NotYetImplemented):
|
||||||
|
source_file = 'tests/samples/codefiles/see.h'
|
||||||
|
parser = TokenParser(source_file)
|
||||||
|
parser.parse()
|
||||||
|
|
||||||
|
mock_extract_tokens.assert_called_once_with()
|
||||||
|
|
||||||
def test_python_dependencies_detected(self):
|
def test_python_dependencies_detected(self):
|
||||||
response = Response()
|
response = Response()
|
||||||
response.status_code = 0
|
response.status_code = 0
|
||||||
|
|
|
@ -6,8 +6,6 @@ from wakatime.packages import requests
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from wakatime.compat import u
|
from wakatime.compat import u
|
||||||
from wakatime.exceptions import NotYetImplemented
|
|
||||||
from wakatime.languages import TokenParser
|
|
||||||
from wakatime.packages.requests.models import Response
|
from wakatime.packages.requests.models import Response
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
|
@ -22,16 +20,6 @@ class LanguagesTestCase(utils.TestCase):
|
||||||
['wakatime.session_cache.SessionCache.get', requests.session],
|
['wakatime.session_cache.SessionCache.get', requests.session],
|
||||||
]
|
]
|
||||||
|
|
||||||
def test_token_parser(self):
|
|
||||||
with utils.mock.patch('wakatime.languages.TokenParser._extract_tokens') as mock_extract_tokens:
|
|
||||||
|
|
||||||
with self.assertRaises(NotYetImplemented):
|
|
||||||
source_file = 'tests/samples/codefiles/see.h'
|
|
||||||
parser = TokenParser(source_file)
|
|
||||||
parser.parse()
|
|
||||||
|
|
||||||
mock_extract_tokens.assert_called_once_with()
|
|
||||||
|
|
||||||
def test_language_detected_for_header_file(self):
|
def test_language_detected_for_header_file(self):
|
||||||
response = Response()
|
response = Response()
|
||||||
response.status_code = 500
|
response.status_code = 500
|
||||||
|
|
Loading…
Reference in a new issue