damebasics 0.2.2__tar.gz → 0.2.3__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.2 → damebasics-0.2.3}/PKG-INFO +1 -1
- damebasics-0.2.3/damebasics/tests/test_lambda.py +74 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics.egg-info/PKG-INFO +1 -1
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics.egg-info/SOURCES.txt +1 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/pyproject.toml +1 -1
- {damebasics-0.2.2 → damebasics-0.2.3}/LICENSE +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/README.md +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/files/buggy.csv +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/files/fiall.csv +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/files/pg1513.txt +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/files/tmp.txt +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/files/tmp2.txt +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/runtests.sh +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/src/calculator.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/src/damebasics.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/src/factorial.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/src/fib.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/src/fraction.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/src/hanoi.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/src/primes.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/src/queuelist.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/tests/__init__.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/tests/test_arithmetics.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/tests/test_collections.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/tests/test_control_structures.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/tests/test_date.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/tests/test_dict.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/tests/test_files.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/tests/test_lists.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/tests/test_network.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/tests/test_poo.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/tests/test_set.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/tests/test_strings.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics/tests/test_tuples.py +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics.egg-info/dependency_links.txt +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics.egg-info/entry_points.txt +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics.egg-info/requires.txt +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/damebasics.egg-info/top_level.txt +0 -0
- {damebasics-0.2.2 → damebasics-0.2.3}/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.3
|
|
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>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
# Copyright (C) 2026 David Arroyo Menéndez
|
|
5
|
+
|
|
6
|
+
# Author: David Arroyo Menéndez <davidam@gmail.com>
|
|
7
|
+
# Maintainer: David Arroyo Menéndez <davidam@gmail.com>
|
|
8
|
+
|
|
9
|
+
# This file is free software; you can redistribute it and/or modify
|
|
10
|
+
# it under the terms of the GNU General Public License as published by
|
|
11
|
+
# the Free Software Foundation; either version 3, or (at your option)
|
|
12
|
+
# any later version.
|
|
13
|
+
|
|
14
|
+
# This file is distributed in the hope that it will be useful,
|
|
15
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
# GNU General Public License for more details.
|
|
18
|
+
|
|
19
|
+
# You should have received a copy of the GNU General Public License
|
|
20
|
+
# along with damebasics; see the file LICENSE. If not, write to
|
|
21
|
+
# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
22
|
+
# Boston, MA 02110-1301 USA,
|
|
23
|
+
|
|
24
|
+
from unittest import TestCase
|
|
25
|
+
from functools import reduce
|
|
26
|
+
|
|
27
|
+
class TestLambda(TestCase):
|
|
28
|
+
|
|
29
|
+
def test_lambda_basic(self):
|
|
30
|
+
x = lambda a, b, c : a + b + c
|
|
31
|
+
self.assertEqual(x(5, 6, 4), 15)
|
|
32
|
+
x = lambda a, b : a * b
|
|
33
|
+
self.assertEqual(x(5, 6), 30)
|
|
34
|
+
x = lambda x: 2 ** x
|
|
35
|
+
self.assertEqual(x(3), 8)
|
|
36
|
+
|
|
37
|
+
def test_lambda_map_power(self):
|
|
38
|
+
x = list(map(lambda x: 2 ** x, range(10)))
|
|
39
|
+
self.assertEqual(x, [1, 2, 4, 8, 16, 32, 64, 128, 256, 512])
|
|
40
|
+
|
|
41
|
+
def test_lambda_map_upper(self):
|
|
42
|
+
a = ["apple", "banana", "cherry"]
|
|
43
|
+
# Use map() with lambda to convert each string to uppercase
|
|
44
|
+
b = map(lambda x: x.upper(), a)
|
|
45
|
+
# Convert the map object to a list and print it
|
|
46
|
+
result = list(b)
|
|
47
|
+
self.assertEqual(result, ["APPLE", "BANANA", "CHERRY"])
|
|
48
|
+
|
|
49
|
+
def test_lambda_map_multiply(self):
|
|
50
|
+
a = [1, 2, 3, 4, 5]
|
|
51
|
+
result = list(map(lambda x: x * 3, a))
|
|
52
|
+
print(result)
|
|
53
|
+
self.assertEqual(result, [3, 6, 9, 12, 15])
|
|
54
|
+
|
|
55
|
+
def test_lambda_map_and_tuples(self):
|
|
56
|
+
nums = (1, 2, 3)
|
|
57
|
+
result = tuple(map(lambda x: x + 1, nums))
|
|
58
|
+
self.assertEqual(result, (2, 3, 4))
|
|
59
|
+
|
|
60
|
+
def test_lambda_reduce_strings(self):
|
|
61
|
+
from functools import reduce
|
|
62
|
+
a = ["Geeks", "for", "Geeks"]
|
|
63
|
+
result = reduce(lambda x, y: x + " " + y, a)
|
|
64
|
+
self.assertEqual(result, "Geeks for Geeks")
|
|
65
|
+
|
|
66
|
+
def test_lambda_reduce_integers(self):
|
|
67
|
+
a = [2, 4, 6, 8]
|
|
68
|
+
result = reduce(lambda x, y: x + y, a)
|
|
69
|
+
self.assertEqual(result, 20)
|
|
70
|
+
|
|
71
|
+
def test_lambda_reduce_highest(self):
|
|
72
|
+
a = [5, 9, 3, 12, 7]
|
|
73
|
+
result = reduce(lambda x, y: x if x > y else y, a)
|
|
74
|
+
self.assertEqual(result, 12)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: damebasics
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
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>
|
|
@@ -28,6 +28,7 @@ damebasics/tests/test_control_structures.py
|
|
|
28
28
|
damebasics/tests/test_date.py
|
|
29
29
|
damebasics/tests/test_dict.py
|
|
30
30
|
damebasics/tests/test_files.py
|
|
31
|
+
damebasics/tests/test_lambda.py
|
|
31
32
|
damebasics/tests/test_lists.py
|
|
32
33
|
damebasics/tests/test_network.py
|
|
33
34
|
damebasics/tests/test_poo.py
|
|
@@ -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.
|
|
20
|
+
version = "0.2.3" # 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
|
|
File without changes
|
|
File without changes
|