Ejemplo n.º 1
0
def test_hashtags():
    month = Month(2000, 10)
    day = Day(month, 20)
    assert day.hashtags == []
    day.text = '#tag'
    assert day.hashtags == ['tag']
    day.text = 'abc #tag'
    assert day.hashtags == ['tag']
    day.text = 'abc #tag_with_longer_name'
    assert day.hashtags == ['tag_with_longer_name']
    day.text = 'abc #tag def'
    assert day.hashtags == ['tag']
Ejemplo n.º 2
0
    def test_day_fragment_anchor_element(self, process):
        date = datetime.date(2019, 10, 21)
        day = Day(Month(date.year, date.month), date.day)

        markup = get_markup_for_day(day, "xhtml", date=date.strftime("%d-%m-%Y"))
        document = process(markup)

        assert r'<span id="{:%Y-%m-%d}"></span>'.format(date) in document
Ejemplo n.º 3
0
def test_compare():
    year_number = 2000
    month_number = 10
    day_number = 15
    month = Month(year_number, month_number)
    day = Day(month, day_number)

    eq_day = Day(month, day_number)
    assert(day == eq_day)

    greater_day = Day(month, day_number + 1)
    assert(day < greater_day)
    assert(day <= greater_day)

    lesser_day = Day(month, day_number - 1)
    assert(day > lesser_day)
    assert(day >= lesser_day)
Ejemplo n.º 4
0
def test_to_string():
    year_number = 2000
    month_number = 10
    day_number = 15
    month = Month(year_number, month_number)
    day = Day(month, day_number)

    str_version = "{}-{}-{:02d}".format(year_number, month_number, day_number)
    assert str(day) == str_version
Ejemplo n.º 5
0
def test_hashtags():
    month = Month(2000, 10)
    day = Day(month, 20)
    assert day.hashtags == []
    day.text = "#tag"
    assert day.hashtags == ["tag"]
    day.text = "abc #tag"
    assert day.hashtags == ["tag"]
    day.text = "abc #tag_with_longer_name"
    assert day.hashtags == ["tag_with_longer_name"]
    day.text = "abc #tag def"
    assert day.hashtags == ["tag"]
Ejemplo n.º 6
0
def test_hashtags():
    month = Month(2000, 10)
    day = Day(month, 20)
    assert day.hashtags == []
    day.text = '#tag'
    assert day.hashtags == ['tag']
    day.text = 'abc #tag'
    assert day.hashtags == ['tag']
    day.text = 'abc #tag_with_longer_name'
    assert day.hashtags == ['tag_with_longer_name']
    day.text = 'abc #tag def'
    assert day.hashtags == ['tag']
Ejemplo n.º 7
0
 def __init__(self, year, month, day):
     import_month = Month(year, month)
     Day.__init__(self, import_month, day)