Added properties for the OBIView class and cleaned up deprecated code
This commit is contained in:
@ -65,7 +65,7 @@ def random_str_with_max_len(max_len):
|
||||
|
||||
|
||||
def random_column(infos):
|
||||
return random.choice(list(infos['view'].get_columns()))
|
||||
return random.choice(list(infos['view'].columns))
|
||||
|
||||
|
||||
def random_unique_name(infos):
|
||||
@ -117,7 +117,7 @@ def test_add_col(config, infos):
|
||||
#existing_col = random_bool(config) # TODO doesn't work because of line count problem. See obiview.c line 1737
|
||||
#if existing_col and infos["view_names"] != [] :
|
||||
# random_view = infos['dms'].open_view(random.choice(infos["view_names"]))
|
||||
# random_column = random_view[random.choice(list(random_view.get_columns()))]
|
||||
# random_column = random_view[random.choice(list(random_view.columns)]
|
||||
# random_column_refs = random_column.refs
|
||||
# if random_column_refs['name'] in infos['view'] :
|
||||
# alias = random_unique_name(infos)
|
||||
@ -132,7 +132,7 @@ def test_add_col(config, infos):
|
||||
|
||||
def test_delete_col(config, infos):
|
||||
print_test(config, ">>> Delete column test")
|
||||
if len(list(infos['view'].get_columns())) <= 1 :
|
||||
if len(list(infos['view'].columns)) <= 1 :
|
||||
print_test(config, "-")
|
||||
return
|
||||
col_name = random_column(infos)
|
||||
@ -218,18 +218,18 @@ def random_new_view(config, infos, first=False):
|
||||
clone = False
|
||||
quality_col = False # TODO
|
||||
if not first:
|
||||
infos['view_names'].append(infos['view'].get_name())
|
||||
infos['view_names'].append(infos['view'].name)
|
||||
infos['view'].save_and_close()
|
||||
v_to_clone = infos['dms'].open_view(random.choice(infos["view_names"]))
|
||||
v_type = None
|
||||
print_test(config, "View to clone: ")
|
||||
print_test(config, repr(v_to_clone))
|
||||
create_line_selection = random_bool(config)
|
||||
if create_line_selection and v_to_clone.get_line_count() > 0:
|
||||
if create_line_selection and v_to_clone.line_count > 0:
|
||||
print_test(config, "New view with new line selection.")
|
||||
line_selection = []
|
||||
for i in range(random.randint(1, v_to_clone.get_line_count())) :
|
||||
line_selection.append(random.randint(0, v_to_clone.get_line_count()-1))
|
||||
for i in range(random.randint(1, v_to_clone.line_count)) :
|
||||
line_selection.append(random.randint(0, v_to_clone.line_count-1))
|
||||
print_test(config, "New line selection: "+str(line_selection))
|
||||
else :
|
||||
v_type = random_view_type()
|
||||
@ -242,9 +242,9 @@ def random_new_view(config, infos, first=False):
|
||||
print_test(config, repr(infos['view']))
|
||||
if v_to_clone is not None :
|
||||
if line_selection is None:
|
||||
assert v_to_clone.get_line_count() == infos['view'].get_line_count(), "New view and cloned view don't have the same line count"
|
||||
assert v_to_clone.line_count == infos['view'].line_count, "New view and cloned view don't have the same line count"
|
||||
else :
|
||||
assert len(line_selection) == infos['view'].get_line_count(), "New view with new line selection does not have the right line count"
|
||||
assert len(line_selection) == infos['view'].line_count, "New view with new line selection does not have the right line count"
|
||||
v_to_clone.save_and_close()
|
||||
if first :
|
||||
fill_view(config, infos)
|
||||
|
Reference in New Issue
Block a user