Example #1
0
def test_chart_states_list_lengths():
    """Test chart state function lists are same length."""
    jd = JobData('test')
    jd.count_states()
    one, two = jd.chart_states()[0], jd.chart_states()[1]
    assert len(one) == len(two)
Example #2
0
def test_count_tags_dict_property_is_updated():
    """Test the count tags method updates the time dict property."""
    jd = JobData('test')
    tags = jd.count_tags()
    assert jd.top_ten == tags
Example #3
0
def test_chart_states_returns_list():
    """Test the chart state function returns list."""
    jd = JobData('test')
    jd.count_states()
    assert isinstance(jd.chart_states(), list)
Example #4
0
def test_days_dict_zero_key_has_values():
    """Test that posts on day of scrape are listed as zero."""
    jd = JobData('test')
    days = jd.count_days()
    assert jd.time_dict['0'] != 0
Example #5
0
def test_count_tags_method_returns_dict():
    """Test the count tags method returns a dictionary."""
    jd = JobData('test')
    assert isinstance(jd.count_tags(), dict)
Example #6
0
def test_initialization_of_test_environment():
    """Test on initialization the environment is set to test."""
    jd = JobData('test')
    assert jd.environment == 'test'
Example #7
0
def test_count_days_dict_property_is_updated():
    """Test the count days method updates the time dict property."""
    jd = JobData('test')
    days = jd.count_days()
    assert jd.time_dict == days
Example #8
0
def test_initialization_has_empty_top_ten():
    """Test top ten dict property is set to none."""
    jd = JobData('test')
    assert jd.top_ten is None
Example #9
0
def test_count_state_dict_property_is_updated():
    """Test the count states method updates the state dict property."""
    jd = JobData('test')
    states = jd.count_states()
    assert jd.state_dict == states
Example #10
0
def test_initialization_has_empty_date():
    """Test date property is set to none."""
    jd = JobData('test')
    assert jd.date is None
Example #11
0
def test_initialization_has_empty_time_dict():
    """Test time dict property is set to none."""
    jd = JobData('test')
    assert jd.time_dict is None
Example #12
0
def test_chart_tags_raises_error():
    """Test chart tags raises error if time dict not available."""
    jd = JobData('test')
    with pytest.raises(ValueError):
        jd.chart_tags()
Example #13
0
def test_week_removed_from_time():
    """Test week is removed from times that have w."""
    jd = JobData('test')
    state_dict = jd.count_states()
    key_list = list(state_dict.values())
    assert 'w' not in key_list
Example #14
0
def test_initialization_of_job_data_has_df():
    """Test on initialization the dataframe is created."""
    jd = JobData('test')
    assert isinstance(jd.df, pd.core.frame.DataFrame)
Example #15
0
def test_hour_removed_from_time():
    """Test hour is removed from times that have h."""
    jd = JobData('test')
    state_dict = jd.count_states()
    key_list = list(state_dict.values())
    assert 'h' not in key_list
Example #16
0
def test_chart_states_raises_error():
    """Test chart state raises error if state dict not available."""
    jd = JobData('test')
    with pytest.raises(ValueError):
        jd.chart_states()