diff --git a/buku b/buku index adb1089..44c61ab 100755 --- a/buku +++ b/buku @@ -2784,14 +2784,14 @@ def convert_bookmark_set( out = '' if export_type == 'markdown': for row in resultset: - if row[2] == '': + if not row[2]: out += '- [Untitled](' + row[1] + ')\n' else: out += '- [' + row[2] + '](' + row[1] + ')\n' count += 1 elif export_type == 'org': for row in resultset: - if row[2] == '': + if row[2]: out += '* [[{}][Untitled]]\n'.format(row[1]) else: out += '* [[{}][{}]]\n'.format(row[1], row[2]) @@ -2809,10 +2809,10 @@ def convert_bookmark_set( '
\n'.format(timestamp)) for row in resultset: - out += ('
\n' '
\n
' ], - ['org', '* [[htttp://example.com][Untitled]]\n* [[http://google.com][Google]]\n'], - ['markdown', '- [Untitled](htttp://example.com)\n- [Google](http://google.com)\n'], + ['org', '* [[htttp://example.com][]]\n* [[htttp://example.org][None]]\n* [[http://google.com][Untitled]]\n'], + ['markdown', '- [Untitled](htttp://example.com)\n- [Untitled](htttp://example.org)\n- [Google](http://google.com)\n'], ['random', None], ]) def test_convert_bookmark_set(export_type, exp_res, monkeypatch): @@ -750,7 +751,7 @@ def test_convert_bookmark_set(export_type, exp_res, monkeypatch): import buku bms = [ (1, 'htttp://example.com', '', ',', '', 0), - (1, 'htttp://example.com', None, ',', '', 0), + (1, 'htttp://example.org', None, ',', '', 0), (2, 'http://google.com', 'Google', ',', '', 0)] if export_type == 'random': with pytest.raises(AssertionError): @@ -761,5 +762,5 @@ def test_convert_bookmark_set(export_type, exp_res, monkeypatch): return 1556430615 monkeypatch.setattr(buku.time, 'time', return_fixed_number) res = convert_bookmark_set(bms, export_type=export_type) - assert res['count'] == 2 + assert res['count'] == 3 assert exp_res == res['data']