damebasics 0.2__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {damebasics-0.2 → damebasics-0.2.2}/PKG-INFO +19 -1
- {damebasics-0.2 → damebasics-0.2.2}/README.md +18 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/tests/test_arithmetics.py +42 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/tests/test_network.py +16 -9
- {damebasics-0.2 → damebasics-0.2.2}/damebasics.egg-info/PKG-INFO +19 -1
- {damebasics-0.2 → damebasics-0.2.2}/pyproject.toml +1 -1
- {damebasics-0.2 → damebasics-0.2.2}/LICENSE +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/files/buggy.csv +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/files/fiall.csv +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/files/pg1513.txt +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/files/tmp.txt +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/files/tmp2.txt +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/runtests.sh +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/src/calculator.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/src/damebasics.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/src/factorial.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/src/fib.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/src/fraction.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/src/hanoi.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/src/primes.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/src/queuelist.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/tests/__init__.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/tests/test_collections.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/tests/test_control_structures.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/tests/test_date.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/tests/test_dict.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/tests/test_files.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/tests/test_lists.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/tests/test_poo.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/tests/test_set.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/tests/test_strings.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics/tests/test_tuples.py +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics.egg-info/SOURCES.txt +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics.egg-info/dependency_links.txt +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics.egg-info/entry_points.txt +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics.egg-info/requires.txt +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/damebasics.egg-info/top_level.txt +0 -0
- {damebasics-0.2 → damebasics-0.2.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: damebasics
|
|
3
|
-
Version: 0.2
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Learning basic control structures and basic datastructures from Tests by David Arroyo Menéndez'
|
|
5
5
|
Author-email: David Arroyo Menéndez <davidam@gmail.com>
|
|
6
6
|
Maintainer-email: David Arroyo Menéndez <davidam@gmail.com>
|
|
@@ -714,27 +714,45 @@ For example, lists, strings, for, dictionaries, ...
|
|
|
714
714
|
# Installing
|
|
715
715
|
|
|
716
716
|
$ mkdir venv-damebasics
|
|
717
|
+
|
|
717
718
|
$ python3 -m venv venv-damebasics
|
|
719
|
+
|
|
718
720
|
$ cd venv-damebasics
|
|
721
|
+
|
|
719
722
|
$ source bin/activate
|
|
723
|
+
|
|
720
724
|
$ pip3 install damebasics
|
|
721
725
|
|
|
722
726
|
# Run tests!
|
|
723
727
|
|
|
728
|
+
All tests
|
|
729
|
+
|
|
724
730
|
$ cd damebasics
|
|
731
|
+
|
|
725
732
|
$ ./runtests.sh
|
|
726
733
|
|
|
734
|
+
Single file of tests
|
|
735
|
+
|
|
736
|
+
$ pytest tests/test_arithmetics.py
|
|
737
|
+
|
|
738
|
+
Single test
|
|
739
|
+
|
|
740
|
+
$ pytest tests/test_arithmetics.py::TddInPythonExample::test_arithmetics_calculator_returns_correct_result
|
|
741
|
+
|
|
727
742
|
# Give me the package
|
|
728
743
|
|
|
729
744
|
<https://python-packaging.readthedocs.io/en/latest/minimal.html>
|
|
730
745
|
|
|
731
746
|
To install from local:
|
|
747
|
+
|
|
732
748
|
$ pip install -e .
|
|
733
749
|
|
|
734
750
|
To install create tar.gz in dist directory:
|
|
751
|
+
|
|
735
752
|
$ python3 -m build
|
|
736
753
|
|
|
737
754
|
To upload to pypi:
|
|
755
|
+
|
|
738
756
|
$ twine upload dist/damebasics-0.2.tar.gz
|
|
739
757
|
|
|
740
758
|
|
|
@@ -7,27 +7,45 @@ For example, lists, strings, for, dictionaries, ...
|
|
|
7
7
|
# Installing
|
|
8
8
|
|
|
9
9
|
$ mkdir venv-damebasics
|
|
10
|
+
|
|
10
11
|
$ python3 -m venv venv-damebasics
|
|
12
|
+
|
|
11
13
|
$ cd venv-damebasics
|
|
14
|
+
|
|
12
15
|
$ source bin/activate
|
|
16
|
+
|
|
13
17
|
$ pip3 install damebasics
|
|
14
18
|
|
|
15
19
|
# Run tests!
|
|
16
20
|
|
|
21
|
+
All tests
|
|
22
|
+
|
|
17
23
|
$ cd damebasics
|
|
24
|
+
|
|
18
25
|
$ ./runtests.sh
|
|
19
26
|
|
|
27
|
+
Single file of tests
|
|
28
|
+
|
|
29
|
+
$ pytest tests/test_arithmetics.py
|
|
30
|
+
|
|
31
|
+
Single test
|
|
32
|
+
|
|
33
|
+
$ pytest tests/test_arithmetics.py::TddInPythonExample::test_arithmetics_calculator_returns_correct_result
|
|
34
|
+
|
|
20
35
|
# Give me the package
|
|
21
36
|
|
|
22
37
|
<https://python-packaging.readthedocs.io/en/latest/minimal.html>
|
|
23
38
|
|
|
24
39
|
To install from local:
|
|
40
|
+
|
|
25
41
|
$ pip install -e .
|
|
26
42
|
|
|
27
43
|
To install create tar.gz in dist directory:
|
|
44
|
+
|
|
28
45
|
$ python3 -m build
|
|
29
46
|
|
|
30
47
|
To upload to pypi:
|
|
48
|
+
|
|
31
49
|
$ twine upload dist/damebasics-0.2.tar.gz
|
|
32
50
|
|
|
33
51
|
|
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
22
22
|
# Boston, MA 02110-1301 USA,
|
|
23
23
|
|
|
24
|
+
# Check https://www.w3schools.com/python/module_math.asp
|
|
25
|
+
|
|
26
|
+
import math
|
|
24
27
|
import unittest
|
|
25
28
|
import collections
|
|
26
29
|
collections.Callable = collections.abc.Callable
|
|
@@ -57,3 +60,42 @@ class TddInPythonExample(unittest.TestCase):
|
|
|
57
60
|
myround2 = round(3.1459, 2)
|
|
58
61
|
round2res = 3.15
|
|
59
62
|
self.assertEqual(round2res, myround2)
|
|
63
|
+
|
|
64
|
+
def test_arithmetics_ceil_floor_returns_correct_result(self):
|
|
65
|
+
myfloor1 = math.floor(1.4)
|
|
66
|
+
myfloor2 = math.floor(1.6)
|
|
67
|
+
myres1 = 1
|
|
68
|
+
self.assertEqual(myfloor1, myres1)
|
|
69
|
+
self.assertEqual(myfloor2, myres1)
|
|
70
|
+
|
|
71
|
+
myceil1 = math.ceil(1.4)
|
|
72
|
+
myceil2 = math.ceil(1.6)
|
|
73
|
+
myres2 = 2
|
|
74
|
+
self.assertEqual(myceil1, myres2)
|
|
75
|
+
self.assertEqual(myceil2, myres2)
|
|
76
|
+
|
|
77
|
+
def test_arithmetics_sqrt_returns_correct_result(self):
|
|
78
|
+
mysqrt1 = math.sqrt(9)
|
|
79
|
+
sqrt1res = 3.0
|
|
80
|
+
self.assertEqual(mysqrt1, sqrt1res)
|
|
81
|
+
mysqrt2 = math.sqrt(25)
|
|
82
|
+
sqrt2res = 5.0
|
|
83
|
+
self.assertEqual(mysqrt2, sqrt2res)
|
|
84
|
+
|
|
85
|
+
def test_arithmetics_sin_returns_correct_result(self):
|
|
86
|
+
mysin1 = math.sin(math.pi/2)
|
|
87
|
+
sin1res = 1.0
|
|
88
|
+
self.assertEqual(mysin1, sin1res)
|
|
89
|
+
mysin2 = math.sin(0)
|
|
90
|
+
sin2res = 0.0
|
|
91
|
+
self.assertEqual(mysin2, sin2res)
|
|
92
|
+
mysin3 = math.sin(math.radians(90))
|
|
93
|
+
sin3res = 1.0
|
|
94
|
+
self.assertEqual(mysin3, sin3res)
|
|
95
|
+
|
|
96
|
+
def test_arithmetics_finite_returns_correct_result(self):
|
|
97
|
+
inf1 = math.isfinite(math.inf)
|
|
98
|
+
inf2 = math.isfinite(float("inf"))
|
|
99
|
+
inf3 = math.isfinite(float("-inf"))
|
|
100
|
+
self.assertEqual(inf1, inf2)
|
|
101
|
+
self.assertEqual(inf2, inf3)
|
|
@@ -32,7 +32,11 @@ collections.Callable = collections.abc.Callable
|
|
|
32
32
|
|
|
33
33
|
class TddInPythonExample(unittest.TestCase):
|
|
34
34
|
|
|
35
|
-
def
|
|
35
|
+
def test_network_socket_gethostbyname(self):
|
|
36
|
+
ip = socket.gethostbyname('localhost')
|
|
37
|
+
self.assertEqual(ip, '127.0.0.1')
|
|
38
|
+
|
|
39
|
+
def test_network_socket_connect(self):
|
|
36
40
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
37
41
|
try:
|
|
38
42
|
s.connect(("www.python.org", 80))
|
|
@@ -40,16 +44,19 @@ class TddInPythonExample(unittest.TestCase):
|
|
|
40
44
|
except:
|
|
41
45
|
pprint("Please, to check the Internet connection")
|
|
42
46
|
|
|
43
|
-
def
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
def test_network_socket_gethostbyaddr(self):
|
|
48
|
+
g = socket.gethostbyaddr('127.0.0.1')
|
|
49
|
+
res = ('localhost', [], ['127.0.0.1'])
|
|
50
|
+
self.assertEqual(g, res)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_network_socket_getservbyname(self):
|
|
46
54
|
proto = "tcp"
|
|
55
|
+
self.assertEqual(socket.getservbyport(80,proto), "http")
|
|
47
56
|
self.assertEqual(socket.getservbyname("ftp",proto), 21)
|
|
48
57
|
self.assertEqual(socket.getservbyname("http",proto), 80)
|
|
49
58
|
self.assertEqual(socket.getservbyname("https",proto), 443)
|
|
50
59
|
self.assertEqual(socket.getservbyport(21,proto), "ftp")
|
|
51
|
-
self.assertEqual(socket.getservbyport(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
n = re.match(r"(\d+)(\.)(\d+)(\.)(\d+)(\.)(\d+)", my_ip)
|
|
55
|
-
self.assertTrue(n)
|
|
60
|
+
self.assertEqual(socket.getservbyport(443,proto), "https")
|
|
61
|
+
|
|
62
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: damebasics
|
|
3
|
-
Version: 0.2
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Learning basic control structures and basic datastructures from Tests by David Arroyo Menéndez'
|
|
5
5
|
Author-email: David Arroyo Menéndez <davidam@gmail.com>
|
|
6
6
|
Maintainer-email: David Arroyo Menéndez <davidam@gmail.com>
|
|
@@ -714,27 +714,45 @@ For example, lists, strings, for, dictionaries, ...
|
|
|
714
714
|
# Installing
|
|
715
715
|
|
|
716
716
|
$ mkdir venv-damebasics
|
|
717
|
+
|
|
717
718
|
$ python3 -m venv venv-damebasics
|
|
719
|
+
|
|
718
720
|
$ cd venv-damebasics
|
|
721
|
+
|
|
719
722
|
$ source bin/activate
|
|
723
|
+
|
|
720
724
|
$ pip3 install damebasics
|
|
721
725
|
|
|
722
726
|
# Run tests!
|
|
723
727
|
|
|
728
|
+
All tests
|
|
729
|
+
|
|
724
730
|
$ cd damebasics
|
|
731
|
+
|
|
725
732
|
$ ./runtests.sh
|
|
726
733
|
|
|
734
|
+
Single file of tests
|
|
735
|
+
|
|
736
|
+
$ pytest tests/test_arithmetics.py
|
|
737
|
+
|
|
738
|
+
Single test
|
|
739
|
+
|
|
740
|
+
$ pytest tests/test_arithmetics.py::TddInPythonExample::test_arithmetics_calculator_returns_correct_result
|
|
741
|
+
|
|
727
742
|
# Give me the package
|
|
728
743
|
|
|
729
744
|
<https://python-packaging.readthedocs.io/en/latest/minimal.html>
|
|
730
745
|
|
|
731
746
|
To install from local:
|
|
747
|
+
|
|
732
748
|
$ pip install -e .
|
|
733
749
|
|
|
734
750
|
To install create tar.gz in dist directory:
|
|
751
|
+
|
|
735
752
|
$ python3 -m build
|
|
736
753
|
|
|
737
754
|
To upload to pypi:
|
|
755
|
+
|
|
738
756
|
$ twine upload dist/damebasics-0.2.tar.gz
|
|
739
757
|
|
|
740
758
|
|
|
@@ -17,7 +17,7 @@ name = "damebasics" # Required
|
|
|
17
17
|
#
|
|
18
18
|
# For a discussion on single-sourcing the version, see
|
|
19
19
|
# https://packaging.python.org/guides/single-sourcing-package-version/
|
|
20
|
-
version = "0.2" # Required
|
|
20
|
+
version = "0.2.2" # Required
|
|
21
21
|
|
|
22
22
|
# This is a one-line description or tagline of what your project does. This
|
|
23
23
|
# corresponds to the "Summary" metadata field:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|