# ratio deprecation

    Code
      new_rec <- step_upsample(recipe(~., data = circle_example), class, ratio = 2)
    Condition
      Error:
      ! The `ratio` argument of `step_upsample()` was deprecated in themis 0.2.0 and is now defunct.
      i Please use the `over_ratio` argument instead.

# bad data

    Code
      prep(step_upsample(rec, x))
    Condition
      Error in `step_upsample()`:
      Caused by error in `prep()`:
      ! `x` should be a factor variable.

---

    Code
      prep(step_upsample(rec, class, id))
    Condition
      Error in `step_upsample()`:
      Caused by error in `prep()`:
      ! The selector should select at most a single variable.

# case_weights

    Code
      rec1_p
    Message
      
      -- Recipe ----------------------------------------------------------------------
      
      -- Inputs 
      Number of variables by role
      predictor:    4
      case_weights: 1
      
      -- Training information 
      Training data contained 400 data points and no incomplete rows.
      
      -- Operations 
      * Up-sampling based on: class | Trained, weighted

---

    Code
      rec1_p
    Message
      
      -- Recipe ----------------------------------------------------------------------
      
      -- Inputs 
      Number of variables by role
      predictor:    4
      case_weights: 1
      
      -- Training information 
      Training data contained 400 data points and no incomplete rows.
      
      -- Operations 
      * Up-sampling based on: class | Trained, ignored weights

# indicator_column bad args

    Code
      step_upsample(recipe(class ~ x + y, data = circle_example), class,
      indicator_column = 1)
    Condition
      Error in `step_upsample()`:
      ! `indicator_column` must be a single string or `NULL`, not the number 1.

---

    Code
      prep(step_upsample(recipe(class ~ x + y, data = circle_example), class,
      indicator_column = ""))
    Condition
      Error in `step_upsample()`:
      ! `indicator_column` must be a single string or `NULL`, not the empty string "".

---

    Code
      prep(step_upsample(recipe(class ~ x + y, data = circle_example), class,
      indicator_column = "x"))
    Condition
      Error in `step_upsample()`:
      Caused by error in `prep()`:
      ! Name collision occurred. The following variable names already exist:
      * `x`

# bad args

    Code
      prep(step_upsample(recipe(~., data = mtcars), over_ratio = "yes"))
    Condition
      Error in `step_upsample()`:
      Caused by error in `prep()`:
      ! `over_ratio` must be a number, not the string "yes".

---

    Code
      step_upsample(recipe(~., data = mtcars), seed = TRUE)
    Condition
      Error in `step_upsample()`:
      ! `seed` must be a whole number, not `TRUE`.

# unused outcome levels are skipped with a warning (#238)

    Code
      res <- bake(prep(step_upsample(recipe(class ~ x + y, data = circle_example),
      class)), new_data = NULL)
    Condition
      Warning in `prep()`:
      Unused factor level "unused" in `class` was dropped.
      i  Level with zero observations is skipped when computing sampling targets.

# step_upsample() errors on a bad `over_ratio` vector (#323)

    Code
      prep(step_upsample(recipe(class ~ x, data = df), class, over_ratio = c(a = 1,
        potato = 1)))
    Condition
      Error in `step_upsample()`:
      Caused by error in `prep()`:
      ! `over_ratio` names must be levels of the outcome.
      x Unknown name: "potato".
      i Available levels: "a" and "b".

---

    Code
      prep(step_upsample(recipe(class ~ x, data = df), class, over_ratio = c(a = 1,
        -1)))
    Condition
      Error in `step_upsample()`:
      Caused by error in `prep()`:
      ! `over_ratio` must be a single number or a named numeric vector.
      i Every element must be named with a level of the outcome.

# step_upsample() checks `over_ratio` names when prepped (#323)

    Code
      prep(step_upsample(recipe(class ~ ., data = df), class, over_ratio = c(a = 1,
        potato = 1)))
    Condition
      Error in `step_upsample()`:
      Caused by error in `prep()`:
      ! `over_ratio` names must be levels of the outcome.
      x Unknown name: "potato".
      i Available levels: "a", "b", and "c".

# bake method errors when needed non-standard role columns are missing

    Code
      bake(trained, new_data = circle_example[, -3])
    Condition
      Error in `step_upsample()`:
      ! The following required column is missing from `new_data`: class.

# empty printing

    Code
      rec
    Message
      
      -- Recipe ----------------------------------------------------------------------
      
      -- Inputs 
      Number of variables by role
      outcome:    1
      predictor: 10
      
      -- Operations 
      * Up-sampling based on: <none>

---

    Code
      rec
    Message
      
      -- Recipe ----------------------------------------------------------------------
      
      -- Inputs 
      Number of variables by role
      outcome:    1
      predictor: 10
      
      -- Training information 
      Training data contained 32 data points and no incomplete rows.
      
      -- Operations 
      * Up-sampling based on: <none> | Trained

# printing

    Code
      print(rec)
    Message
      
      -- Recipe ----------------------------------------------------------------------
      
      -- Inputs 
      Number of variables by role
      predictor: 4
      
      -- Operations 
      * Up-sampling based on: class

---

    Code
      prep(rec)
    Message
      
      -- Recipe ----------------------------------------------------------------------
      
      -- Inputs 
      Number of variables by role
      predictor: 4
      
      -- Training information 
      Training data contained 400 data points and no incomplete rows.
      
      -- Operations 
      * Up-sampling based on: class | Trained

