import pandas as pd

from mltils.encoders import InfrequentValueEncoder


def test_infrequent_value_encoder_1():
    ive = InfrequentValueEncoder()
    assert ive is not None


def test_infrequent_value_encoder_2():
    df = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
    ive = InfrequentValueEncoder(thrshld=1, str_rpl='ifq')
    encoded = ive.fit_transform(df)
    expected = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'ifq']})
    assert expected.equals(encoded)

import pandas as pd

from mltils.encoders import InfrequentValueEncoder


def test_infrequent_value_encoder_1():
    ive = InfrequentValueEncoder()
    assert ive is not None


def test_infrequent_value_encoder_2():
    df = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
    ive = InfrequentValueEncoder(thrshld=1, str_rpl='ifq')
    encoded = ive.fit_transform(df)
    expected = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'ifq']})
    assert expected.equals(encoded)


def test_infrequent_value_encoder_3():
    df = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
    ive = InfrequentValueEncoder(thrshld=0, str_rpl='ifq')
    encoded = ive.fit_transform(df)
    expected = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
    assert expected.equals(encoded)


def test_infrequent_value_encoder_4():
    df = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
    ive = InfrequentValueEncoder(thrshld=0, str_rpl='ifq')
    encoded = ive.fit_transform(df)
    expected = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
    assert expected.equals(encoded)

Add more unit tests for InfrequentValueEncoder
Add more unit tests for InfrequentValueEncoder

  import pandas as pd
  
  from mltils.encoders import InfrequentValueEncoder
  
  
  def test_infrequent_value_encoder_1():
      ive = InfrequentValueEncoder()
      assert ive is not None
  
  
  def test_infrequent_value_encoder_2():
      df = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
      ive = InfrequentValueEncoder(thrshld=1, str_rpl='ifq')
      encoded = ive.fit_transform(df)
      expected = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'ifq']})
      assert expected.equals(encoded)
  
+ 
+ def test_infrequent_value_encoder_3():
+     df = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
+     ive = InfrequentValueEncoder(thrshld=0, str_rpl='ifq')
+     encoded = ive.fit_transform(df)
+     expected = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
+     assert expected.equals(encoded)
+ 
+ 
+ def test_infrequent_value_encoder_4():
+     df = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
+     ive = InfrequentValueEncoder(thrshld=0, str_rpl='ifq')
+     encoded = ive.fit_transform(df)
+     expected = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
+     assert expected.equals(encoded)
+ 
Add more unit tests for InfrequentValueEncoder
## Code Before:
import pandas as pd

from mltils.encoders import InfrequentValueEncoder


def test_infrequent_value_encoder_1():
    ive = InfrequentValueEncoder()
    assert ive is not None


def test_infrequent_value_encoder_2():
    df = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
    ive = InfrequentValueEncoder(thrshld=1, str_rpl='ifq')
    encoded = ive.fit_transform(df)
    expected = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'ifq']})
    assert expected.equals(encoded)

## Instruction:
Add more unit tests for InfrequentValueEncoder
## Code After:
import pandas as pd

from mltils.encoders import InfrequentValueEncoder


def test_infrequent_value_encoder_1():
    ive = InfrequentValueEncoder()
    assert ive is not None


def test_infrequent_value_encoder_2():
    df = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
    ive = InfrequentValueEncoder(thrshld=1, str_rpl='ifq')
    encoded = ive.fit_transform(df)
    expected = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'ifq']})
    assert expected.equals(encoded)


def test_infrequent_value_encoder_3():
    df = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
    ive = InfrequentValueEncoder(thrshld=0, str_rpl='ifq')
    encoded = ive.fit_transform(df)
    expected = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
    assert expected.equals(encoded)


def test_infrequent_value_encoder_4():
    df = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
    ive = InfrequentValueEncoder(thrshld=0, str_rpl='ifq')
    encoded = ive.fit_transform(df)
    expected = pd.DataFrame({'A': ['a', 'a', 'b', 'b', 'c']})
    assert expected.equals(encoded)
