# coding: utf8
"""Test bbs2ch.decode module."""
from bbs2ch import decode


def test_menu():
    """Parse bbsmenu html."""
    body = u"""
<B>カテゴリ1</B><BR>
<A HREF=http://test2ch.net/hoge/>ほげ</A><br>
<A HREF=http://test2ch.net/fuga/>ふが</A><br>
<BR><BR><B>カテゴリ2</B><BR>
<A HREF=http://test2ch.net/foo/>foo</A><br>"""
    ret = list(decode.menu(body))
    assert (u'http://test2ch.net/hoge/', u'カテゴリ1', u'ほげ') == ret[0]
    assert (u'http://test2ch.net/fuga/', u'カテゴリ1', u'ふが') == ret[1]
    assert (u'http://test2ch.net/foo/', u'カテゴリ2', u'foo') == ret[2]

@@ -547,8 +547,263 @@
  ret%5B2%5D%0A
+%0A%0Adef test_board_subject():%0A    %22%22%22Parse board subject.txt.%22%22%22%0A    body = u%22%22%22%0A100.dat%3C%3E%E3%82%B9%E3%83%AC%E3%83%83%E3%83%891 (2)%0A200.dat%3C%3E%E3%82%B9%E3%83%AC%E3%83%83%E3%83%892 (1000)%22%22%22%0A    ret = list(decode.board_subject(body))%0A    assert (u'100', u'%E3%82%B9%E3%83%AC%E3%83%83%E3%83%891', 2) == ret%5B0%5D%0A    assert (u'200', u'%E3%82%B9%E3%83%AC%E3%83%83%E3%83%892', 1000) == ret%5B1%5D%0A

add test for decode.board_subject()