Esempio n. 1
0
def test_set_semantic_tags_with_index(sample_series):
    semantic_tags = {'tag1', 'tag2'}
    data_col = DataColumn(sample_series, semantic_tags=semantic_tags, use_standard_tags=False)
    data_col._set_as_index()
    assert data_col.semantic_tags == {'tag1', 'tag2', 'index'}
    new_tags = ['new_tag']
    new_col = data_col.set_semantic_tags(new_tags)
    assert new_col.semantic_tags == {'index', 'new_tag'}
    new_col2 = new_col.set_semantic_tags(new_tags, retain_index_tags=False)
    assert new_col2.semantic_tags == {'new_tag'}
Esempio n. 2
0
def test_reset_semantic_tags_with_index(sample_series):
    semantic_tags = 'initial_tag'
    data_col = DataColumn(sample_series,
                          semantic_tags=semantic_tags,
                          use_standard_tags=False)

    data_col._set_as_index()
    new_col = data_col.reset_semantic_tags(retain_index_tags=True)
    assert new_col.semantic_tags == {'index'}
    new_col = data_col.reset_semantic_tags()
    assert new_col.semantic_tags == set()
Esempio n. 3
0
def test_set_logical_type_retains_index_tag(sample_series):
    data_col = DataColumn(sample_series,
                          logical_type=NaturalLanguage,
                          semantic_tags='original_tag',
                          use_standard_tags=False)

    data_col._set_as_index()
    assert data_col.semantic_tags == {'index', 'original_tag'}
    new_col = data_col.set_logical_type(Categorical)
    assert new_col.semantic_tags == {'index'}
    new_col = data_col.set_logical_type(Categorical, retain_index_tags=False)
    assert new_col.semantic_tags == set()
Esempio n. 4
0
def test_set_as_index(sample_series):
    data_col = DataColumn(sample_series)
    data_col._set_as_index()
    assert 'index' in data_col.semantic_tags