Skip to content

Commit

Permalink
removing the skipUnless code broke the linter validation, so I readde…
Browse files Browse the repository at this point in the history
…d it
  • Loading branch information
Charlemagne3 committed Apr 18, 2016
1 parent d085a68 commit 9a24ffd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rest_framework_xml/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def parse(self, stream, media_type=None, parser_context=None):

def _check_xml_list(self, element):
"""
Checks that an element has multiple tags and that they are all the same,
Checks that an element has multiple tags and that they are all the same,
to validate that the element is a properly formatted list
"""
return len(element) > 1 and len(set([child.tag for child in element])) <= 1
Expand Down
5 changes: 5 additions & 0 deletions tests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@


from django.test import TestCase
from django.utils import unittest
from django.utils.six.moves import StringIO
from rest_framework_xml.parsers import XMLParser
from rest_framework_xml.compat import etree
Expand Down Expand Up @@ -95,21 +96,25 @@ def setUp(self):
]
}

@unittest.skipUnless(etree, 'defusedxml not installed')
def test_parse(self):
parser = XMLParser()
data = parser.parse(self._input)
self.assertEqual(data, self._data)

@unittest.skipUnless(etree, 'defusedxml not installed')
def test_complex_data_parse(self):
parser = XMLParser()
data = parser.parse(self._complex_data_input)
self.assertEqual(data, self._complex_data)

@unittest.skipUnless(etree, 'defusedxml not installed')
def test_invalid_list_parse(self):
parser = XMLParser()
data = parser.parse(self._invalid_list_input)
self.assertEqual(data, self._invalid_list_output)

@unittest.skipUnless(etree, 'defusedxml not installed')
def test_valid_list_parse(self):
parser = XMLParser()
data = parser.parse(self._valid_list_input)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from decimal import Decimal

from django.test import TestCase
from django.utils import unittest
from django.utils.six.moves import StringIO
from rest_framework_xml.renderers import XMLRenderer
from rest_framework_xml.parsers import XMLParser
Expand Down Expand Up @@ -96,6 +97,7 @@ def test_render_list(self):
self.assertXMLContains(content, '<sub_data_list><list-item>')
self.assertXMLContains(content, '</list-item></sub_data_list>')

@unittest.skipUnless(etree, 'defusedxml not installed')
def test_render_and_parse_complex_data(self):
"""
Test XML rendering.
Expand Down

0 comments on commit 9a24ffd

Please sign in to comment.