Fixing a warning and moving some tests around.

This commit is contained in:
Dave Halter
2017-08-05 21:31:13 +02:00
parent 172a534baa
commit 1b235e16e1
2 changed files with 9 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import codecs
import warnings
import re
from contextlib import contextmanager
@@ -570,7 +571,10 @@ class ErrorFinder(Normalizer):
func = codecs.unicode_escape_decode
try:
func(payload)
with warnings.catch_warnings():
# The warnings from parsing strings are not relevant.
warnings.filterwarnings('ignore')
func(payload)
except UnicodeDecodeError as e:
self._add_syntax_error('(unicode error) ' + str(e), leaf)
except ValueError as e: