Added a test for is_valid_sequence