From f92d336dbe9fb9e4cdd4b0b1dbb7be738c93b8b7 Mon Sep 17 00:00:00 2001 From: Haidong Ji Date: Sat, 28 Jul 2018 15:14:27 -0500 Subject: Initial commit. --- AlgoDesignAndTechniqueEdxPython/.project | 17 +++++++++++++++++ AlgoDesignAndTechniqueEdxPython/.pydevproject | 10 ++++++++++ AlgoDesignAndTechniqueEdxPython/sources/aplusb.py | 12 ++++++++++++ AlgoDesignAndTechniqueEdxPython/tests/a_plus_bTest.py | 19 +++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 AlgoDesignAndTechniqueEdxPython/.project create mode 100644 AlgoDesignAndTechniqueEdxPython/.pydevproject create mode 100644 AlgoDesignAndTechniqueEdxPython/sources/aplusb.py create mode 100644 AlgoDesignAndTechniqueEdxPython/tests/a_plus_bTest.py diff --git a/AlgoDesignAndTechniqueEdxPython/.project b/AlgoDesignAndTechniqueEdxPython/.project new file mode 100644 index 0000000..ee76980 --- /dev/null +++ b/AlgoDesignAndTechniqueEdxPython/.project @@ -0,0 +1,17 @@ + + + AlgoDesignAndTechniqueEdxPython + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/AlgoDesignAndTechniqueEdxPython/.pydevproject b/AlgoDesignAndTechniqueEdxPython/.pydevproject new file mode 100644 index 0000000..ab4689e --- /dev/null +++ b/AlgoDesignAndTechniqueEdxPython/.pydevproject @@ -0,0 +1,10 @@ + + + + /${PROJECT_DIR_NAME} + /${PROJECT_DIR_NAME}/sources + /${PROJECT_DIR_NAME}/tests + + python interpreter + Default + 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() -- cgit v1.2.3