import pytest

@pytest.mark.vcr()
def test_public_tl_anonymous(api_anonymous, status):
    tl = api_anonymous.timeline_public()
    assert status['id'] in map(lambda st: st['id'], tl)
    # although tempting, we can't do
    #     assert status in tl
    # because the statuses returned in the tl have additional
    # pagination-related attributes

@pytest.mark.vcr()
def test_public_tl(api, status):
    public = api.timeline_public()
    local = api.timeline_local()
    assert status['id'] in map(lambda st: st['id'], public)
    assert status['id'] in map(lambda st: st['id'], local)

@pytest.mark.vcr()
def test_home_tl(api, status):
    tl = api.timeline_home()
    assert status['id'] in map(lambda st: st['id'], tl)

@pytest.mark.vcr()
def test_hashtag_tl(api):
    status = api.status_post('#hoot (hashtag toot)')
    tl = api.timeline_hashtag('hoot')
    try:
        assert status['id'] in map(lambda st: st['id'], tl)
    finally:
        api.status_delete(status['id'])

@pytest.mark.vcr()
def test_home_tl_anonymous_throws(api_anonymous):
    from mastodon.Mastodon import MastodonAPIError
    with pytest.raises(MastodonAPIError):
        tl = api_anonymous.timeline_home()

@@ -6,16 +6,93 @@
 t pytest
+%0Afrom mastodon.Mastodon import MastodonAPIError, MastodonIllegalArgumentError
 %0A%0A@pytes
@@ -1055,16 +1055,149 @@
 'id'%5D)%0A%0A
+def test_hashtag_tl_leading_hash(api):%0A    with pytest.raises(MastodonIllegalArgumentError):%0A        api.timeline_hashtag('#hoot')%0A%0A%0A
 @pytest.
@@ -1261,59 +1261,8 @@
 s):%0A
-    from mastodon.Mastodon import MastodonAPIError%0A
     
@@ -1303,20 +1303,15 @@
 r):%0A
+
        
- tl =
  api

add test for throwing when requesting a hashtag tl with a leading hash