---
id: 68af276c60e009597dd861e7
title: Step 7
challengeType: 20
dashedName: step-7
---

# --description--

Finally, create one last `if` statement to verify if `duration` is not greater than `0` and raise a `ValueError` with the message `Duration must be positive`.

# --hints--

You should raise a `ValueError` with the message `Duration must be positive` when `duration` is not a positive number.

```js
({
  test: () => runPython(`
  _msg = 'Duration must be positive'
  _expected_error = f"Expected to raise 'ValueError: {_msg}'"
  try:
    Movie('The Matrix', 1999, 'The Wachowskis', 0)
  except ValueError as e:
    assert str(e) == _msg
  else:
    assert False, _expected_error

  try:
    Movie('The Matrix', 1999, 'The Wachowskis', -1)
  except ValueError as e:
    assert str(e) == _msg
  else:
    assert False, _expected_error
  `)
})
```

You should not raise a `ValueError` when `duration` is a valid number.

```js
({
    test: () => runPython(`
    try:
      Movie('The Matrix', 1999, 'The Wachowskis', 136)
    except ValueError:
      assert False, 'Expected not to raise a ValueError with valid duration'
    `)
})
```

# --seed--

## --seed-contents--

```py
class Movie:
--fcc-editable-region--
    def __init__(self, title, year, director, duration):
        if not title.strip():
            raise ValueError('Title cannot be empty')
        if year < 1895:
            raise ValueError('Year must be 1895 or later')
        if not director.strip():
            raise ValueError('Director cannot be empty')
        
        self.title = title
        self.year = year
        self.director = director
        self.duration = duration
--fcc-editable-region--
    def __str__(self):
        return f'{self.title} ({self.year}) - {self.duration} min, {self.director}'

movie1 = Movie('The Matrix', 1999, 'The Wachowskis', 136)
print(movie1)
```
