diff --git a/Makefile b/Makefile
index 56f93ad..470e3e5 100644
--- a/Makefile
+++ b/Makefile
@@ -38,8 +38,8 @@ site: $(RST) $(WWW) $(CSS)
cd docs && sphinx-build -b dirhtml . _build/html
coverage:
- nosetests --with-doctest --with-doctest-ignore-unicode --with-coverage \
- --cover-package=isso --cover-html isso/ specs/
+ nosetests --with-doctest --with-coverage --cover-package=isso \
+ --cover-html isso/ specs/
clean:
rm -f $(MAN) $(CSS) $(ISSO_JS_DST) $(ISSO_CSS_DST)
diff --git a/isso/core.py b/isso/core.py
index 6936261..bd886c7 100644
--- a/isso/core.py
+++ b/isso/core.py
@@ -57,28 +57,6 @@ class IssoParser(ConfigParser):
Extended :class:`ConfigParser` to parse human-readable timedeltas
into seconds and handles multiple values per key.
- >>> import io
- >>> parser = IssoParser(allow_no_value=True)
- >>> parser.read_file(io.StringIO(u'''
- ... [foo]
- ... bar = 1h
- ... baz = 12
- ... spam = a, b, cdef
- ... bla =
- ... spam
- ... ham
- ... asd = fgh
- ... '''))
- >>> parser.getint("foo", "bar")
- 3600
- >>> parser.getint("foo", "baz")
- 12
- >>> parser.getlist("foo", "spam") # doctest: +IGNORE_UNICODE
- ['a', 'b', 'cdef']
- >>> list(parser.getiter("foo", "bla")) # doctest: +IGNORE_UNICODE
- ['spam', 'ham']
- >>> list(parser.getiter("foo", "asd")) # doctest: +IGNORE_UNICODE
- ['fgh']
"""
@classmethod
diff --git a/isso/utils/__init__.py b/isso/utils/__init__.py
index 6a6da27..36896ec 100644
--- a/isso/utils/__init__.py
+++ b/isso/utils/__init__.py
@@ -27,12 +27,6 @@ def anonymize(remote_addr):
Anonymize IPv4 and IPv6 :param remote_addr: to /24 (zero'd)
and /48 (zero'd).
- >>> anonymize(u'12.34.56.78') # doctest: +IGNORE_UNICODE
- '12.34.56.0'
- >>> anonymize(u'1234:5678:90ab:cdef:fedc:ba09:8765:4321') # doctest: +IGNORE_UNICODE
- '1234:5678:90ab:0000:0000:0000:0000:0000'
- >>> anonymize(u'::ffff:127.0.0.1') # doctest: +IGNORE_UNICODE
- '127.0.0.0'
"""
try:
ipv4 = ipaddress.IPv4Address(remote_addr)
diff --git a/isso/utils/parse.py b/isso/utils/parse.py
index cf5ec78..6fdc837 100644
--- a/isso/utils/parse.py
+++ b/isso/utils/parse.py
@@ -56,44 +56,6 @@ def thread(data, default=u"Untitled.", id=None):
"""
Extract
title from web page. The title is *probably* the text node,
which is the nearest H1 node in context to an element with the `isso-thread` id.
-
- >>> thread("asdf") # doctest: +IGNORE_UNICODE
- (None, 'Untitled.')
- >>> thread('''
- ...
- ...
- ... Foo!
- ...
- ...
- ...
- ... generic website title.
- ... subtile title.
- ...
- ...
- ...
- ... Can you find me?
- ...
- ...
- ...
- ...
- ... ''') # doctest: +IGNORE_UNICODE
- (None, 'Can you find me?')
- >>> thread('''
- ...
- ...
- ... I'm the real title!1
- ...
- ... ''') # doctest: +IGNORE_UNICODE
- (None, 'No way!')
- >>> thread('''
- ...
- ... ''') # doctest: +IGNORE_UNICODE
- ('test', 'Test')
- >>> thread('''
- ...
- ... ''') # doctest: +IGNORE_UNICODE
- ('Fuu.', 'Untitled.')
"""
html = html5lib.parse(data, treebuilder="dom")
diff --git a/specs/test_core.py b/specs/test_core.py
new file mode 100644
index 0000000..b60b98d
--- /dev/null
+++ b/specs/test_core.py
@@ -0,0 +1,32 @@
+# -*- encoding: utf-8 -*-
+
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
+
+import io
+
+from isso import core
+
+
+class TestConfig(unittest.TestCase):
+
+ def test_parser(self):
+
+ parser = core.IssoParser(allow_no_value=True)
+ parser.read_file(io.StringIO(u"""
+ [foo]
+ bar = 1h
+ baz = 12
+ spam = a, b, cdef
+ bla =
+ spam
+ ham
+ asd = fgh"""))
+
+ self.assertEqual(parser.getint("foo", "bar"), 3600)
+ self.assertEqual(parser.getint("foo", "baz"), 12)
+ self.assertEqual(parser.getlist("foo", "spam"), ['a', 'b', 'cdef'])
+ self.assertEqual(list(parser.getiter("foo", "bla")), ['spam', 'ham'])
+ self.assertEqual(list(parser.getiter("foo", "asd")), ['fgh'])
diff --git a/specs/test_utils.py b/specs/test_utils.py
new file mode 100644
index 0000000..88668f4
--- /dev/null
+++ b/specs/test_utils.py
@@ -0,0 +1,63 @@
+# -*- encoding: utf-8 -*-
+
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
+
+
+from isso import utils
+from isso.utils import parse
+
+
+class TestUtils(unittest.TestCase):
+
+ def test_anonymize(self):
+
+ examples = [
+ (u'12.34.56.78', u'12.34.56.0'),
+ (u'1234:5678:90ab:cdef:fedc:ba09:8765:4321', u'1234:5678:90ab:0000:0000:0000:0000:0000'),
+ (u'::ffff:127.0.0.1', u'127.0.0.0')]
+
+ for (addr, anonymized) in examples:
+ self.assertEqual(utils.anonymize(addr), anonymized)
+
+
+class TestParse(unittest.TestCase):
+
+ def test_thread(self):
+ self.assertEqual(parse.thread("asdf"), (None, 'Untitled.'))
+
+ self.assertEqual(parse.thread("""
+
+
+ Foo!
+
+
+
+ generic website title.
+ subtile title.
+
+
+
+
+
+
+ """), (None, 'Can you find me?'))
+
+ self.assertEqual(parse.thread("""
+
+
+ I'm the real title!1
+
+ """), (None, 'No way!'))
+
+ self.assertEqual(parse.thread("""
+
+ """), ('test', 'Test'))
+
+ self.assertEqual(parse.thread(''),
+ ('Fuu.', 'Untitled.'))
diff --git a/tox.ini b/tox.ini
index bacd1cd..045b8b7 100755
--- a/tox.ini
+++ b/tox.ini
@@ -22,8 +22,7 @@ deps =
[testenv]
deps =
nose
- doctest-ignore-unicode
commands =
- nosetests --with-doctest --with-doctest-ignore-unicode isso/ specs/
+ nosetests --with-doctest isso/ specs/
install_command =
pip install --allow-external ipaddr --allow-unverified ipaddr {opts} {packages}