diff options
-rw-r--r-- | AlgoDesignAndTechniqueEdxPython/.project | 17 | ||||
-rw-r--r-- | AlgoDesignAndTechniqueEdxPython/.pydevproject | 10 | ||||
-rw-r--r-- | AlgoDesignAndTechniqueEdxPython/sources/aplusb.py | 12 | ||||
-rw-r--r-- | AlgoDesignAndTechniqueEdxPython/tests/a_plus_bTest.py | 19 |
4 files changed, 58 insertions, 0 deletions
diff --git a/AlgoDesignAndTechniqueEdxPython/.project b/AlgoDesignAndTechniqueEdxPython/.project new file mode 100644 index 0000000..ee76980 --- /dev/null +++ b/AlgoDesignAndTechniqueEdxPython/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>AlgoDesignAndTechniqueEdxPython</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.python.pydev.PyDevBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.python.pydev.pythonNature</nature> + </natures> +</projectDescription> diff --git a/AlgoDesignAndTechniqueEdxPython/.pydevproject b/AlgoDesignAndTechniqueEdxPython/.pydevproject new file mode 100644 index 0000000..ab4689e --- /dev/null +++ b/AlgoDesignAndTechniqueEdxPython/.pydevproject @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?eclipse-pydev version="1.0"?><pydev_project> + <pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> + <path>/${PROJECT_DIR_NAME}</path> + <path>/${PROJECT_DIR_NAME}/sources</path> + <path>/${PROJECT_DIR_NAME}/tests</path> + </pydev_pathproperty> + <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property> + <pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property> +</pydev_project> diff --git a/AlgoDesignAndTechniqueEdxPython/sources/aplusb.py b/AlgoDesignAndTechniqueEdxPython/sources/aplusb.py new file mode 100644 index 0000000..9594dbc --- /dev/null +++ b/AlgoDesignAndTechniqueEdxPython/sources/aplusb.py @@ -0,0 +1,12 @@ +#Uses python3 +import sys + +def add(a, b): + return a + b + +if __name__ == '__main__': + entryNumbers = sys.stdin.read() + tokens = entryNumbers.split() + a = int(tokens[0]) + b = int(tokens[1]) + print(add(a,b)) diff --git a/AlgoDesignAndTechniqueEdxPython/tests/a_plus_bTest.py b/AlgoDesignAndTechniqueEdxPython/tests/a_plus_bTest.py new file mode 100644 index 0000000..afea1d1 --- /dev/null +++ b/AlgoDesignAndTechniqueEdxPython/tests/a_plus_bTest.py @@ -0,0 +1,19 @@ +''' +Created on Jul 26, 2018 + +@author: haidong +''' +import unittest + +from sources.aplusb import add # @UnresolvedImport + +class Test(unittest.TestCase): + + + def testName(self): + self.assertEqual(5, add(2,3)) + + +if __name__ == "__main__": + #import sys;sys.argv = ['', 'Test.testName'] + unittest.main() |