Sha256: af8c471e5502d0f33cce0b366b30c548134ff1223ed773108ec8d2c1c3c2f348

Contents?: true

Size: 1.93 KB

Versions: 49

Compression:

Stored size: 1.93 KB

Contents

import unittest

from kindergarten_garden import Garden

# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0


class KindergartenGardenTests(unittest.TestCase):
    def test_garden_with_single_student(self):
        self.assertEqual(
            Garden("RC\nGG").plants("Alice"),
            "Radishes Clover Grass Grass".split())

    def test_different_garden_with_single_student(self):
        self.assertEqual(
            Garden("VC\nRC").plants("Alice"),
            "Violets Clover Radishes Clover".split())

    def test_garden_with_two_students(self):
        garden = Garden("VVCG\nVVRC")
        self.assertEqual(
            garden.plants("Bob"), "Clover Grass Radishes Clover".split())

    def test_multiple_students_for_the_same_garden_with_three_students(self):
        garden = Garden("VVCCGG\nVVCCGG")
        self.assertEqual(garden.plants("Bob"), ["Clover"] * 4)
        self.assertEqual(garden.plants("Charlie"), ["Grass"] * 4)

    def test_full_garden(self):
        garden = Garden("VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV")
        self.assertEqual(
            garden.plants("Alice"),
            "Violets Radishes Violets Radishes".split())
        self.assertEqual(
            garden.plants("Bob"), "Clover Grass Clover Clover".split())
        self.assertEqual(
            garden.plants("Kincaid"), "Grass Clover Clover Grass".split())
        self.assertEqual(
            garden.plants("Larry"), "Grass Violets Clover Violets".split())

    # Additional tests for this track
    def test_disordered_test(self):
        garden = Garden(
            "VCRRGVRG\nRVGCCGCV",
            students="Samantha Patricia Xander Roger".split())
        self.assertEqual(
            garden.plants("Patricia"),
            "Violets Clover Radishes Violets".split())
        self.assertEqual(
            garden.plants("Xander"), "Radishes Grass Clover Violets".split())


if __name__ == '__main__':
    unittest.main()

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
trackler-2.2.1.105 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.104 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.103 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.102 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.101 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.100 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.99 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.98 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.97 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.96 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.95 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.94 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.93 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.92 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.91 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.90 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.89 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.88 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.87 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py
trackler-2.2.1.86 tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py