Skip to content

Commit

Permalink
Fix some unittest imports
Browse files Browse the repository at this point in the history
  • Loading branch information
sampsyo committed Jun 11, 2016
1 parent a11e628 commit 883a5b9
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 8 deletions.
3 changes: 2 additions & 1 deletion test/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import confuse
import argparse
import optparse
from . import unittest
import unittest


class ArgparseTest(unittest.TestCase):
def setUp(self):
Expand Down
3 changes: 2 additions & 1 deletion test/test_dump.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import confuse
import textwrap
from . import unittest, _root
import unittest
from . import _root


class PrettyDumpTest(unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions test/test_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import posixpath
import shutil
import tempfile

from . import unittest
import unittest

DEFAULT = [platform.system, os.environ, os.path]
SYSTEMS = {
Expand Down
3 changes: 2 additions & 1 deletion test/test_valid.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import confuse
import os
import collections
from . import _root, unittest
import unittest
from . import _root


class ValidConfigTest(unittest.TestCase):
Expand Down
5 changes: 4 additions & 1 deletion test/test_validation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import confuse
import os
from . import _root, unittest
import unittest
from . import _root


class TypeCheckTest(unittest.TestCase):
def test_str_type_correct(self):
Expand All @@ -23,6 +25,7 @@ def test_int_type_incorrect(self):
with self.assertRaises(confuse.ConfigTypeError):
config['foo'].get(int)


class BuiltInValidatorTest(unittest.TestCase):
def test_as_filename_with_non_file_source(self):
config = _root({'foo': 'foo/bar'})
Expand Down
8 changes: 7 additions & 1 deletion test/test_views.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import confuse
import sys
from . import _root, unittest
import unittest
from . import _root

PY3 = sys.version_info[0] == 3


class SingleSourceTest(unittest.TestCase):
def test_dict_access(self):
config = _root({'foo': 'bar'})
Expand Down Expand Up @@ -60,6 +62,7 @@ def test_int_contents(self):
with self.assertRaises(confuse.ConfigTypeError):
list(config['n'].all_contents())


class ConverstionTest(unittest.TestCase):
def test_str_conversion_from_str(self):
config = _root({'foo': 'bar'})
Expand Down Expand Up @@ -87,6 +90,7 @@ def test_bool_conversion_from_int(self):
value = bool(config['foo'])
self.assertEqual(value, False)


class NameTest(unittest.TestCase):
def test_root_name(self):
config = _root()
Expand All @@ -107,6 +111,7 @@ def test_nested_access_name(self):
name = config[5]['foo']['bar'][20].name
self.assertEqual(name, "#5.foo.bar#20")


class MultipleSourceTest(unittest.TestCase):
def test_dict_access_shadowed(self):
config = _root({'foo': 'bar'}, {'foo': 'baz'})
Expand Down Expand Up @@ -204,6 +209,7 @@ def test_add_source(self):
self.assertEqual(config['foo'].get(), 'bar')
self.assertEqual(config['baz'].get(), 'qux')


class SetTest(unittest.TestCase):
def test_set_missing_top_level_key(self):
config = _root({})
Expand Down
6 changes: 5 additions & 1 deletion test/test_yaml.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import confuse
import yaml
from . import unittest, TempDir
import unittest
from . import TempDir


def load(s):
return yaml.load(s, Loader=confuse.Loader)


class ParseTest(unittest.TestCase):
def test_dict_parsed_as_ordereddict(self):
v = load("a: b\nc: d")
Expand All @@ -15,6 +18,7 @@ def test_string_beginning_with_percent(self):
v = load("foo: %bar")
self.assertEqual(v['foo'], '%bar')


class FileParseTest(unittest.TestCase):
def _parse_contents(self, contents):
with TempDir() as temp:
Expand Down

0 comments on commit 883a5b9

Please sign in to comment.