Ejemplo n.º 1
0
 def test_countingsort_scrambled(self):
     mock_1 = mock.Mock(cnt=1)
     mock_2 = mock.Mock(cnt=2)
     mock_3 = mock.Mock(cnt=3)
     actual_list = [mock_1, mock_3, mock_2]
     expected_list = [mock_1, mock_2, mock_3]
     radix.RadixSort()._counting_sort(actual_list, 1)
     self.assertEqual(actual_list, expected_list)
Ejemplo n.º 2
0
def main():
    if len(sys.argv) != 3:
        print("Usage: fasta_percentage <fasta_file> <output_file>")
    fasta_filepath = sys.argv[1]
    output_filepath = sys.argv[2]

    seq_dict, max_val = build_sequence_dict(fasta_filepath)
    seq_list = convert_to_list(seq_dict)
    radix.RadixSort().sort(seq_list, max_val)

    write_to_file(seq_list, output_filepath)
Ejemplo n.º 3
0
 def test_countingsort_empty_no_failure(self):
     actual_list = []
     radix.RadixSort()._counting_sort(actual_list, 1)
     self.assertEqual(actual_list, [])
Ejemplo n.º 4
0
 def test_sort_max_is_thousands(self):
     with patch.object(radix.RadixSort, '_counting_sort') as mock_sort:
         radix.RadixSort().sort([], 1000)
     self.assertEqual(mock_sort.call_count, 4)