Exemplo n.º 1
0
def test_basic() -> None:
    # todo maybe this should call stat or something instead?
    # would ensure reasonable stat implementation as well and less duplication
    # note: deliberately use old module (instead of my.reddit.all) to test bwd compatibility
    from my.reddit import saved, events
    assert len(list(events())) > 0
    assert len(list(saved())) > 0
Exemplo n.º 2
0
Arquivo: reddit.py Projeto: xdrie/HPI
def test_disappearing() -> None:
    from my.reddit import events, inputs, saved
    # eh. so for instance, 'metro line colors' is missing from reddit-20190402005024.json for no reason
    # but I guess it was just a short glitch... so whatever
    saves = events()
    favs = [s.kind for s in saves if s.text == 'favorited']
    [deal_with_it] = [f for f in favs if f.title == '"Deal with it!"']
    assert deal_with_it.backup_dt == datetime(2019, 4, 1, 23, 10, 25, tzinfo=pytz.utc)
Exemplo n.º 3
0
def test_unfav() -> None:
    ev = events()
    url = 'https://reddit.com/r/QuantifiedSelf/comments/acxy1v/personal_dashboard/'
    uev = [e for e in ev if e.url == url]
    assert len(uev) == 2
    ff = uev[0]
    # TODO could recover these from takeout perhaps?
    assert ff.text == 'favorited [initial]'
    uf = uev[1]
    assert uf.text == 'unfavorited'
Exemplo n.º 4
0
def test_unfavorite() -> None:
    from my.reddit.rexport import events
    evs = events()
    unfavs = [s for s in evs if s.text == 'unfavorited']
    [xxx] = [u for u in unfavs if u.eid == 'unf-19ifop']
    assert xxx.dt == datetime(2019, 1, 29, 10, 10, 20, tzinfo=pytz.utc)
Exemplo n.º 5
0
def test() -> None:
    from my.reddit import events, inputs, saved
    list(events())
    list(saved())
Exemplo n.º 6
0
def test_reddit_has_data() -> None:
    assert ilen(events(parallel=False)) > 10
    assert ilen(saved()) > 10
    assert ilen(inputs()) >= 1
    assert ilen(pushshift_comments()) > ilen(_dal().comments())
Exemplo n.º 7
0
def test() -> None:
    list(events())
    list(saved())
Exemplo n.º 8
0
def test_unfavorite() -> None:
    evs = events()
    unfavs = [s for s in evs if s.text == 'unfavorited']
    [xxx] = [u for u in unfavs if u.eid == 'unf-19ifop']
    assert xxx.dt == datetime(2019, 1, 28, 8, 10, 20, tzinfo=pytz.utc)