Пример #1
0
 def setUp(self):
     self.data = {
         100: toggle_doors(generate_doors(100)),
         999: toggle_doors(generate_doors(999))
     }
Пример #2
0
 def test_generate_doors_1_generates_closed_door(self):
     result = generate_doors(1)
     self.assertEqual(result[0].is_open, False)
Пример #3
0
 def test_generate_doors_1000_generates_closed_doors(self):
     result = generate_doors(1000)
     for i in range(0, 1000):
         self.assertEqual(result[i].is_open, False)
Пример #4
0
 def test_generate_doors_1_generates_correct_id_value(self):
     result = generate_doors(1)
     self.assertEqual(result[0].id, 1)
Пример #5
0
 def test_generate_doors_1000_generates_correct_id_values(self):
     result = generate_doors(1000)
     for i in range(0, 1000):
         self.assertEqual(result[i].id, i + 1)
Пример #6
0
 def test_generate_doors_1_generates_Door_instance(self):
     result = generate_doors(1)
     self.assertEqual(type(result[0]).__name__, "Door")
Пример #7
0
 def test_generate_doors_1000_generates_Door_instances(self):
     result = generate_doors(1000)
     for i in range(0, 1000):
         self.assertEqual(type(result[i]).__name__, "Door")
Пример #8
0
 def test_generate_doors_927_generates_927_instance(self):
     result = generate_doors(927)
     self.assertEqual(len(result), 927)
Пример #9
0
 def test_generate_doors_2_generates_2_instance(self):
     result = generate_doors(2)
     self.assertEqual(len(result), 2)
Пример #10
0
 def test_generate_doors_1_generates_1_instance(self):
     result = generate_doors(1)
     self.assertEqual(len(result), 1)
Пример #11
0
 def test_collect_open_doors_10_toggled(self):
     result = collect_open_doors(toggle_doors(generate_doors(10)))
     self.assertEqual(result, ["1", "4", "9"])
Пример #12
0
 def test_collect_open_doors_10_every_left_closed(self):
     result = collect_open_doors(generate_doors(10))
     self.assertEqual(result, [])