<commit_before>import os
from StringIO import StringIO

from django.core.management import call_command
from django.test import TestCase, override_settings
from django.core.management.base import CommandError
from django.contrib.gis.gdal import GDALException
from geotrek.zoning.models import RestrictedArea, RestrictedAreaType


class RestrictedAreasCommandTest(TestCase):

    def setUp(self):
        self.filename_out_in = os.path.join(os.path.dirname(__file__), 'data', 'polygons_in_out.geojson')
        self.filename = os.path.join(os.path.dirname(__file__), 'data', 'city.shp')

    """
    Get Restricted Area
    """
    def test_load_restricted_areas_without_file(self):
        with self.assertRaises(CommandError) as e:
            call_command('loadrestrictedareas')
        self.assertEqual(u'Error: too few arguments', e.exception.message)

    def test_load_cities_without_type(self):
        with self.assertRaises(CommandError) as e:
            call_command('loadrestrictedareas', self.filename_out_in)
        self.assertEqual(u'Error: too few arguments', e.exception.message)
<commit_msg>Remove useless import<commit_after>import os
from StringIO import StringIO

from django.core.management import call_command
from django.test import TestCase, override_settings
from django.core.management.base import CommandError
from geotrek.zoning.models import RestrictedArea, RestrictedAreaType


class RestrictedAreasCommandTest(TestCase):

    def setUp(self):
        self.filename_out_in = os.path.join(os.path.dirname(__file__), 'data', 'polygons_in_out.geojson')
        self.filename = os.path.join(os.path.dirname(__file__), 'data', 'city.shp')

    """
    Get Restricted Area
    """
    def test_load_restricted_areas_without_file(self):
        with self.assertRaises(CommandError) as e:
            call_command('loadrestrictedareas')
        self.assertEqual(u'Error: too few arguments', e.exception.message)

    def test_load_cities_without_type(self):
        with self.assertRaises(CommandError) as e:
            call_command('loadrestrictedareas', self.filename_out_in)
        self.assertEqual(u'Error: too few arguments', e.exception.message)

{'fraction_non_alphanumeric': 0.09412304866850321, 'fraction_numerical': 0.0, 'mean_word_length': 4.340686274509804, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7572966', 'n_tokens_mistral': 664, 'n_tokens_neox': 635, 'n_words': 134}