|
@@ -184,18 +184,14 @@ class TestDirection(Base):
|
184
|
184
|
|
185
|
185
|
def test_no_molecules_around(self):
|
186
|
186
|
# No molecule
|
187
|
|
- try: # WTF ?
|
188
|
|
- self.assertRaises(NoMolecule, self._test_direction_for_points({}, -1))
|
189
|
|
- except NoMolecule:
|
190
|
|
- self.assertTrue(True)
|
|
187
|
+ with self.assertRaises(NoMolecule):
|
|
188
|
+ self._test_direction_for_points({}, -1)
|
191
|
189
|
|
192
|
190
|
# Wrong molecule type
|
193
|
|
- try: # WTF ?
|
194
|
|
- self.assertRaises(NoMolecule, self._test_direction_for_points({
|
|
191
|
+ with self.assertRaises(NoMolecule):
|
|
192
|
+ self._test_direction_for_points({
|
195
|
193
|
_p(SOUTH_EST): {MOLECULES_DIRECTION: {PHEROMON_DIR_NONE: (9, 5, 0)}}
|
196
|
|
- }, -1))
|
197
|
|
- except NoMolecule:
|
198
|
|
- self.assertTrue(True)
|
|
194
|
+ }, -1)
|
199
|
195
|
|
200
|
196
|
def test_appose(self):
|
201
|
197
|
self._test_point_raise_no_molecule()
|
|
@@ -217,20 +213,15 @@ class TestDirection(Base):
|
217
|
213
|
self._test_direction_for_points({}, NORTH, re_init=False)
|
218
|
214
|
self._test_direction_for_point({}, NORTH, re_init=False)
|
219
|
215
|
|
220
|
|
-
|
221
|
216
|
def _test_point_raise_no_molecule(self, molecules={}, direction=-1, molecule_type=PHEROMON_DIR_EXPLO,
|
222
|
217
|
reference_point=_p(CENTER), re_init=True):
|
223
|
|
- try: # WTF ?
|
|
218
|
+ with self.assertRaises(NoMolecule):
|
224
|
219
|
self._test_direction_for_point(molecules, direction, re_init=re_init)
|
225
|
|
- except NoMolecule:
|
226
|
|
- self.assertTrue(True)
|
227
|
220
|
|
228
|
221
|
def _test_points_raise_no_molecule(self, molecules={}, direction=-1, molecule_type=PHEROMON_DIR_EXPLO,
|
229
|
222
|
reference_point=_p(CENTER), re_init=True):
|
230
|
|
- try: # WTF ?
|
|
223
|
+ with self.assertRaises(NoMolecule):
|
231
|
224
|
self._test_direction_for_points(molecules, direction, re_init=re_init)
|
232
|
|
- except NoMolecule:
|
233
|
|
- self.assertTrue(True)
|
234
|
225
|
|
235
|
226
|
def _get_molecule(self, type, distance):
|
236
|
227
|
return Molecule(MOLECULES_DIRECTION, type, distance=distance)
|