Skip to content

Commit

Permalink
Assorted fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed Nov 14, 2023
1 parent 7809da7 commit 946aac6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/biocutils/Factor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .print_truncated import print_truncated_list

from .subset_sequence import subset_sequence
from .assign_sequence import assign_sequence
from .combine_sequences import combine_sequences
from .is_list_of_type import is_list_of_type

Expand Down
2 changes: 1 addition & 1 deletion src/biocutils/Names.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def _combine_names(*x: Any, get_names: Callable) -> Union[Names, None]:
for y in x:
n = get_names(y)
if n is None:
all_names.append(len(x))
all_names.append(len(y))
else:
has_names = True
all_names.append(n)
Expand Down
10 changes: 6 additions & 4 deletions tests/test_Factor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from biocutils import Factor, combine, StringList, subset_sequence
from biocutils import Factor, combine, StringList, subset_sequence, assign_sequence
import pytest
import copy
import numpy
Expand Down Expand Up @@ -223,9 +223,9 @@ def test_Factor_generics():
assert list(sub._codes) == [2, 3]
assert sub.get_levels() == f.get_levels()

ass = assign_Sequence(f, range(2, 4), f[1:3])
assert list(sub._codes) == [0, 1, 1, 2, 4]
assert sub.get_levels() == f.get_levels()
ass = assign_sequence(f, range(2, 4), f[1:3])
assert list(ass._codes) == [0, 1, 1, 2, 4]
assert ass.get_levels() == f.get_levels()


def test_Factor_combine():
Expand Down Expand Up @@ -258,8 +258,10 @@ def test_Factor_combine():
assert not out.get_ordered()

# Checking that names are correctly combined.
print(f1)
named = f2.set_names(["alpha", "bravo", "charlie"])
out = combine(f1, named)
print(out)
assert out.get_names() == ["", "", "", "", "", "alpha", "bravo", "charlie"]


Expand Down

0 comments on commit 946aac6

Please sign in to comment.