добавлен кодинг на занятии 23 тест метода target
This commit is contained in:
parent
dd539555b9
commit
5e0cf283d6
|
@ -1,4 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.11" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11" project-jdk-type="Python SDK" />
|
||||
</project>
|
|
@ -4,10 +4,7 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="b389cdea-22f5-4ba2-8b46-337091984b3c" name="Changes" comment="код по 22 части урока">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ShipField.py" beforeDir="false" afterPath="$PROJECT_DIR$/ShipField.py" afterDir="false" />
|
||||
</list>
|
||||
<list default="true" id="b389cdea-22f5-4ba2-8b46-337091984b3c" name="Changes" comment="код по 22 части урока" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
|
@ -37,20 +34,21 @@
|
|||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"Python.ShipField.executor": "Run",
|
||||
"Python.main (1).executor": "Run",
|
||||
"Python.main.executor": "Debug",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"last_opened_file_path": "Y:/Downloads/временный гит/hnc-eduard/HNS/Excercises/ShipCraft/Переделка"
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"Python.ShipField.executor": "Run",
|
||||
"Python.main (1).executor": "Run",
|
||||
"Python.main.executor": "Debug",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"last_opened_file_path": "C:/Users/Eduardo/Documents/Программирование с Артуром/HNS/hnc-eduard/HNS/Excercises/ShipCraft"
|
||||
}
|
||||
}</component>
|
||||
}]]></component>
|
||||
<component name="RunManager" selected="Python.main">
|
||||
<configuration name="ShipField" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||
<module name="Переделка" />
|
||||
<option name="ENV_FILES" value="" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
|
@ -72,6 +70,7 @@
|
|||
</configuration>
|
||||
<configuration name="ShipView" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||
<module name="Переделка" />
|
||||
<option name="ENV_FILES" value="" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
|
@ -93,6 +92,7 @@
|
|||
</configuration>
|
||||
<configuration name="main (1)" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||
<module name="Переделка" />
|
||||
<option name="ENV_FILES" value="" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
|
@ -114,6 +114,7 @@
|
|||
</configuration>
|
||||
<configuration name="main" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||
<module name="Переделка" />
|
||||
<option name="ENV_FILES" value="" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
|
@ -169,7 +170,7 @@
|
|||
<breakpoints>
|
||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||
<url>file://$PROJECT_DIR$/main.py</url>
|
||||
<line>136</line>
|
||||
<line>133</line>
|
||||
<option name="timeStamp" value="1" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -58,7 +58,42 @@ class TestShipField(TestCase):
|
|||
def test_action(self):
|
||||
self.fail()
|
||||
|
||||
def test_target(self):
|
||||
def test_target_ShipMode_PUT(self):
|
||||
ship_field = ShipField()
|
||||
ship_field.set_ship_size(3)
|
||||
ship_field.set_ship_direction(ShipDirection.HORIZONTAL)
|
||||
index = 5 * ship_field.field_size + 5
|
||||
|
||||
old_field_string = str.join(' ', ship_field.field)
|
||||
ship_field.target(5, 5)
|
||||
field_after_target = [ship_field.field[index], ship_field.field[index + 1], ship_field.field[index + 2]]
|
||||
ship_field.field[index] = ' '
|
||||
ship_field.field[index + 1] = ' '
|
||||
ship_field.field[index + 2] = ' '
|
||||
|
||||
new_field_string = str.join(' ', ship_field.field)
|
||||
|
||||
self.assertListEqual(['p', 'p', 'p'], field_after_target)
|
||||
self.assertNotIn('p', new_field_string)
|
||||
self.assertEqual(new_field_string, old_field_string)
|
||||
|
||||
def test_target_ShipMode_SHOOT(self):
|
||||
ship_field = ShipField()
|
||||
ship_field.toggle_field_mode()
|
||||
|
||||
index = 5 * ship_field.field_size + 5
|
||||
|
||||
old_field_string = str.join(' ', ship_field.field)
|
||||
ship_field.target(5, 5)
|
||||
field_after_target = ship_field.field[index]
|
||||
ship_field.field[index] = ship_field.field[index].replace('+', '')
|
||||
new_field_string = str.join(' ', ship_field.field)
|
||||
|
||||
self.assertIn('+', field_after_target)
|
||||
self.assertNotIn('+', new_field_string)
|
||||
self.assertEqual(new_field_string, old_field_string)
|
||||
|
||||
def get_ship(self):
|
||||
self.fail()
|
||||
|
||||
def test_clear_marker(self):
|
||||
|
|
Loading…
Reference in New Issue