From b6d74b24eb9425846d4844ec44a00d66b9f68b23 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 15 Nov 2019 20:35:19 +0100 Subject: [PATCH] rover: define default values for Rover fields --- rover/rover.py | 4 ++-- rover/test_rover.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/rover/rover.py b/rover/rover.py index 577d4d3..af8a8a6 100644 --- a/rover/rover.py +++ b/rover/rover.py @@ -9,5 +9,5 @@ class Vector: @dataclass class Rover: - pos: Vector - planet_size: Vector + pos: Vector = (0, 0) + planet_size: Vector = (100, 100) diff --git a/rover/test_rover.py b/rover/test_rover.py index b0b0c00..cb0b328 100644 --- a/rover/test_rover.py +++ b/rover/test_rover.py @@ -4,3 +4,8 @@ from rover import Rover def test_rover_constructor(): rov = Rover(pos=(0, 0), planet_size=(100, 100)) assert rov.pos == (0, 0) and rov.planet_size == (100, 100) + + +def test_rover_default_values(): + rov = Rover() + assert rov.pos == (0, 0) and rov.planet_size == (100, 100)