From b90f92e5572e808975e75268f0687bd70b002842 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 15 Nov 2019 20:34:34 +0100 Subject: [PATCH] rover: use real Vector class --- rover/rover.py | 10 +++++++--- rover/test_rover.py | 5 +++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/rover/rover.py b/rover/rover.py index 9d11a8d..577d4d3 100644 --- a/rover/rover.py +++ b/rover/rover.py @@ -1,9 +1,13 @@ from dataclasses import dataclass -from typing import Tuple -Vector = Tuple[int, int] @dataclass -class Rover(): +class Vector: + x: int + y: int + + +@dataclass +class Rover: pos: Vector planet_size: Vector diff --git a/rover/test_rover.py b/rover/test_rover.py index 87fb1cc..b0b0c00 100644 --- a/rover/test_rover.py +++ b/rover/test_rover.py @@ -1,5 +1,6 @@ -from rover import * +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)) + assert rov.pos == (0, 0) and rov.planet_size == (100, 100)