Skip to content

Commit

Permalink
Checking for raising the correct exception and moved the strings used…
Browse files Browse the repository at this point in the history
… in the test to a list of strings
  • Loading branch information
Corey Oordt committed Feb 14, 2011
1 parent 6aad1c4 commit 31f1bfe
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions categories/tests/category_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import unittest, os
from categories.models import Category
from categories.management.commands.import_categories import Command
from django.core.management.base import CommandError

class CategoryImportTest(unittest.TestCase):
def setUp(self):
Expand Down Expand Up @@ -39,11 +40,11 @@ def testMixingTabsSpaces(self):
"""
Should raise an exception.
"""
string1 = "cat1\n cat1-1\n\tcat1-2-FAIL!\n"
string2 = "cat1\n\tcat1-1\n cat1-2-FAIL!\n"
string1 = ["cat1"," cat1-1", "\tcat1-2-FAIL!",""]
string2 = ["cat1","\tcat1-1"," cat1-2-FAIL!",""]
cmd = Command()

# raise Exception
self.assertRaises(cmd.parse_lines(string1), Command.CommandError)
self.assertRaises(cmd.parse_lines(string2), Command.CommandError)
self.assertRaises(CommandError, cmd.parse_lines, string1)
self.assertRaises(CommandError, cmd.parse_lines, string2)

0 comments on commit 31f1bfe

Please sign in to comment.