def test_fit_transform(params):
    """Test that fit_transform and fit then transform yield same results."""
    bop_1, bop_2 = BagOfPatterns(**params), BagOfPatterns(**params)
    arr_1 = bop_1.fit_transform(X)
    arr_2 = bop_2.fit(X).transform(X)
    assert bop_1.vocabulary_ == bop_2.vocabulary_
    if isinstance(arr_1, np.ndarray):
        np.testing.assert_array_equal(arr_1, arr_2)
    else:
        np.testing.assert_array_equal(arr_1.A, arr_2.A)
Test that fit_transform and fit then transform yield same results.
pyts/transformation/tests/test_bag_of_patterns.py