inpsPyPI 1.0.2__tar.gz → 1.0.4__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.
- inpspypi-1.0.4/.gitignore +2 -0
- {inpspypi-1.0.2 → inpspypi-1.0.4}/PKG-INFO +1 -1
- {inpspypi-1.0.2 → inpspypi-1.0.4}/__init__.py +1 -1
- {inpspypi-1.0.2 → inpspypi-1.0.4}/check.py +10 -0
- {inpspypi-1.0.2 → inpspypi-1.0.4}/pyproject.toml +1 -1
- {inpspypi-1.0.2 → inpspypi-1.0.4}/test_all.py +7 -38
- inpspypi-1.0.2/.gitignore +0 -1
- {inpspypi-1.0.2 → inpspypi-1.0.4}/.github/workflows/build_inpsPyPI.yml +0 -0
- {inpspypi-1.0.2 → inpspypi-1.0.4}/LICENSE +0 -0
- {inpspypi-1.0.2 → inpspypi-1.0.4}/README.md +0 -0
- {inpspypi-1.0.2 → inpspypi-1.0.4}/builder_for_flask_jsonify.py +0 -0
- {inpspypi-1.0.2 → inpspypi-1.0.4}/cipher.py +0 -0
- {inpspypi-1.0.2 → inpspypi-1.0.4}/convert.py +0 -0
- {inpspypi-1.0.2 → inpspypi-1.0.4}/dictionarily.py +0 -0
- {inpspypi-1.0.2 → inpspypi-1.0.4}/easy_sql.py +0 -0
- {inpspypi-1.0.2 → inpspypi-1.0.4}/excellent_reader.py +0 -0
- {inpspypi-1.0.2 → inpspypi-1.0.4}/memory.py +0 -0
- {inpspypi-1.0.2 → inpspypi-1.0.4}/simple_file_handler.py +0 -0
- {inpspypi-1.0.2 → inpspypi-1.0.4}/sort.py +0 -0
- {inpspypi-1.0.2 → inpspypi-1.0.4}/stackily.py +0 -0
- {inpspypi-1.0.2 → inpspypi-1.0.4}/test.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: inpsPyPI
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.4
|
|
4
4
|
Summary: PyPI package designed to make development in Python easier.
|
|
5
5
|
Project-URL: Homepage, https://github.com/isaiahnoelpulidosalazar/inpsPyPI
|
|
6
6
|
Author-email: Isaiah Noel Pulido Salazar <isaiahnoelpulidosalazar@gmail.com>
|
|
@@ -2,6 +2,7 @@ import re
|
|
|
2
2
|
import base64
|
|
3
3
|
import os
|
|
4
4
|
import pkgutil
|
|
5
|
+
import socket
|
|
5
6
|
|
|
6
7
|
class Check:
|
|
7
8
|
class Email:
|
|
@@ -69,3 +70,12 @@ class Check:
|
|
|
69
70
|
@staticmethod
|
|
70
71
|
def has_spaces(string: str) -> bool:
|
|
71
72
|
return ' ' in string
|
|
73
|
+
|
|
74
|
+
@staticmethod
|
|
75
|
+
def is_connected():
|
|
76
|
+
try:
|
|
77
|
+
socket.create_connection(("8.8.8.8", 53), timeout=3)
|
|
78
|
+
return True
|
|
79
|
+
except OSError:
|
|
80
|
+
pass
|
|
81
|
+
return False
|
|
@@ -4,10 +4,8 @@ import sqlite3
|
|
|
4
4
|
import io
|
|
5
5
|
from contextlib import redirect_stdout
|
|
6
6
|
|
|
7
|
-
# External dependency required by excellent_reader.py
|
|
8
7
|
import openpyxl
|
|
9
8
|
|
|
10
|
-
# Import the modules and components under test
|
|
11
9
|
from builder_for_flask_jsonify import bake, JSON_RESPONSE_TITLE
|
|
12
10
|
from check import Check
|
|
13
11
|
from cipher import Cipher
|
|
@@ -66,7 +64,6 @@ class TestBuilderForFlaskJsonify(unittest.TestCase):
|
|
|
66
64
|
|
|
67
65
|
class TestCheck(unittest.TestCase):
|
|
68
66
|
def setUp(self):
|
|
69
|
-
# Reset Check.Email class variables to prevent test contamination
|
|
70
67
|
Check.Email.valid_domain_names = []
|
|
71
68
|
Check.Email.valid_domain_extensions = []
|
|
72
69
|
Check.Email.valid_domains = []
|
|
@@ -79,8 +76,8 @@ class TestCheck(unittest.TestCase):
|
|
|
79
76
|
|
|
80
77
|
self.assertTrue(Check.Email.is_valid("user@gmail.com"))
|
|
81
78
|
self.assertFalse(Check.Email.is_valid("user@yahoo.com"))
|
|
82
|
-
self.assertFalse(Check.Email.is_valid("user@gmail"))
|
|
83
|
-
self.assertFalse(Check.Email.is_valid("invalid_email"))
|
|
79
|
+
self.assertFalse(Check.Email.is_valid("user@gmail"))
|
|
80
|
+
self.assertFalse(Check.Email.is_valid("invalid_email"))
|
|
84
81
|
|
|
85
82
|
def test_email_full_domain_validation(self):
|
|
86
83
|
Check.Email.add_valid_domain("yahoo.com")
|
|
@@ -92,22 +89,19 @@ class TestCheck(unittest.TestCase):
|
|
|
92
89
|
self.assertFalse(Check.Email.is_valid("invalid_email"))
|
|
93
90
|
|
|
94
91
|
def test_is_a_valid_philippine_mobile_number(self):
|
|
95
|
-
# Valid patterns
|
|
96
92
|
self.assertTrue(Check.is_a_valid_philippine_mobile_number("09171234567"))
|
|
97
93
|
self.assertTrue(Check.is_a_valid_philippine_mobile_number("+639171234567"))
|
|
98
94
|
self.assertTrue(Check.is_a_valid_philippine_mobile_number("639171234567"))
|
|
99
95
|
self.assertTrue(Check.is_a_valid_philippine_mobile_number(" (0917) 123-4567 "))
|
|
100
96
|
|
|
101
|
-
|
|
102
|
-
self.assertFalse(Check.is_a_valid_philippine_mobile_number("
|
|
103
|
-
self.assertFalse(Check.is_a_valid_philippine_mobile_number("
|
|
104
|
-
self.assertFalse(Check.is_a_valid_philippine_mobile_number("
|
|
105
|
-
self.assertFalse(Check.is_a_valid_philippine_mobile_number("0917abc4567")) # Non-digits
|
|
97
|
+
self.assertFalse(Check.is_a_valid_philippine_mobile_number("08171234567"))
|
|
98
|
+
self.assertFalse(Check.is_a_valid_philippine_mobile_number("091712345"))
|
|
99
|
+
self.assertFalse(Check.is_a_valid_philippine_mobile_number("091712345678"))
|
|
100
|
+
self.assertFalse(Check.is_a_valid_philippine_mobile_number("0917abc4567"))
|
|
106
101
|
|
|
107
102
|
def test_is_all_numbers(self):
|
|
108
103
|
self.assertTrue(Check.is_all_numbers("123456"))
|
|
109
104
|
self.assertFalse(Check.is_all_numbers("123a45"))
|
|
110
|
-
# Python's all() returns True for empty sequences
|
|
111
105
|
self.assertTrue(Check.is_all_numbers(""))
|
|
112
106
|
|
|
113
107
|
def test_has_numbers(self):
|
|
@@ -213,31 +207,25 @@ class TestEasySQL(unittest.TestCase):
|
|
|
213
207
|
pass
|
|
214
208
|
|
|
215
209
|
def test_database_crud_operations(self):
|
|
216
|
-
# Create table
|
|
217
210
|
self.sql.create_table("users", {"id": "INTEGER PRIMARY KEY", "name": "TEXT"})
|
|
218
211
|
|
|
219
|
-
# Insert records
|
|
220
212
|
self.sql.insert_to_table("users", {"id": 1, "name": "Alice"})
|
|
221
213
|
self.sql.insert_to_table("users", {"id": 2, "name": "Bob"})
|
|
222
214
|
|
|
223
|
-
# Get records
|
|
224
215
|
rows = self.sql.get_table_values("users")
|
|
225
216
|
self.assertEqual(len(rows), 2)
|
|
226
217
|
self.assertEqual(rows[0], (1, "Alice"))
|
|
227
218
|
self.assertEqual(rows[1], (2, "Bob"))
|
|
228
219
|
|
|
229
|
-
# Delete record with matching condition
|
|
230
220
|
self.sql.delete_from_table("users", {"id": 1})
|
|
231
221
|
rows = self.sql.get_table_values("users")
|
|
232
222
|
self.assertEqual(len(rows), 1)
|
|
233
223
|
self.assertEqual(rows[0], (2, "Bob"))
|
|
234
224
|
|
|
235
|
-
# Clear records
|
|
236
225
|
self.sql.clear_table("users")
|
|
237
226
|
rows = self.sql.get_table_values("users")
|
|
238
227
|
self.assertEqual(len(rows), 0)
|
|
239
228
|
|
|
240
|
-
# Delete Table
|
|
241
229
|
self.sql.delete_table("users")
|
|
242
230
|
with self.assertRaises(sqlite3.OperationalError):
|
|
243
231
|
self.sql.get_table_values("users")
|
|
@@ -245,13 +233,11 @@ class TestEasySQL(unittest.TestCase):
|
|
|
245
233
|
def test_print_table(self):
|
|
246
234
|
self.sql.create_table("users", {"id": "INTEGER PRIMARY KEY", "name": "TEXT"})
|
|
247
235
|
|
|
248
|
-
# Capture output on empty table
|
|
249
236
|
f_empty = io.StringIO()
|
|
250
237
|
with redirect_stdout(f_empty):
|
|
251
238
|
self.sql.print_table("users")
|
|
252
239
|
self.assertIn("Table 'users' is empty.", f_empty.getvalue())
|
|
253
240
|
|
|
254
|
-
# Capture output on populated table
|
|
255
241
|
self.sql.insert_to_table("users", {"id": 1, "name": "Alice"})
|
|
256
242
|
f_populated = io.StringIO()
|
|
257
243
|
with redirect_stdout(f_populated):
|
|
@@ -267,7 +253,6 @@ class TestExcellentReader(unittest.TestCase):
|
|
|
267
253
|
ws1.title = "SheetA"
|
|
268
254
|
ws2 = wb.create_sheet("SheetB")
|
|
269
255
|
|
|
270
|
-
# Set up values to meet the skip_rows threshold (default is 2)
|
|
271
256
|
ws1.append(["Header1"])
|
|
272
257
|
ws1.append(["Header2"])
|
|
273
258
|
ws1.append(["ValA3"])
|
|
@@ -338,30 +323,24 @@ class TestMemory(unittest.TestCase):
|
|
|
338
323
|
def test_memory_lifecycle(self):
|
|
339
324
|
self.assertEqual(self.memory.count(), 0)
|
|
340
325
|
|
|
341
|
-
# Add
|
|
342
326
|
self.memory.add("data1")
|
|
343
327
|
self.memory.add("data2")
|
|
344
328
|
self.assertEqual(self.memory.count(), 2)
|
|
345
329
|
|
|
346
|
-
# Contains
|
|
347
330
|
self.assertTrue(self.memory.contains("data1"))
|
|
348
331
|
self.assertFalse(self.memory.contains("data3"))
|
|
349
332
|
|
|
350
|
-
# Get
|
|
351
333
|
self.assertEqual(self.memory.get(0), "data1")
|
|
352
334
|
self.assertEqual(self.memory.get(1), "data2")
|
|
353
335
|
|
|
354
|
-
# Remove element
|
|
355
336
|
self.memory.remove("data1")
|
|
356
337
|
self.assertEqual(self.memory.count(), 1)
|
|
357
338
|
self.assertFalse(self.memory.contains("data1"))
|
|
358
339
|
|
|
359
|
-
# Remove at index
|
|
360
340
|
self.memory.add("data3")
|
|
361
|
-
self.memory.remove_at(0)
|
|
341
|
+
self.memory.remove_at(0)
|
|
362
342
|
self.assertEqual(self.memory.get(0), "data3")
|
|
363
343
|
|
|
364
|
-
# Clear
|
|
365
344
|
self.memory.clear()
|
|
366
345
|
self.assertEqual(self.memory.count(), 0)
|
|
367
346
|
|
|
@@ -378,15 +357,12 @@ class TestSimpleFileHandler(unittest.TestCase):
|
|
|
378
357
|
pass
|
|
379
358
|
|
|
380
359
|
def test_file_operations(self):
|
|
381
|
-
# Write
|
|
382
360
|
SimpleFileHandler.write(self.filepath, "hello")
|
|
383
361
|
self.assertTrue(os.path.exists(self.filepath))
|
|
384
362
|
|
|
385
|
-
# Read
|
|
386
363
|
content = SimpleFileHandler.read(self.filepath)
|
|
387
364
|
self.assertEqual(content, "hello")
|
|
388
365
|
|
|
389
|
-
# Append
|
|
390
366
|
SimpleFileHandler.append(self.filepath, " world")
|
|
391
367
|
content = SimpleFileHandler.read(self.filepath)
|
|
392
368
|
self.assertEqual(content, "hello world")
|
|
@@ -418,13 +394,11 @@ class TestSort(unittest.TestCase):
|
|
|
418
394
|
self.assertEqual(counting_sort([]), [])
|
|
419
395
|
|
|
420
396
|
def test_bucket_sort_uniform(self):
|
|
421
|
-
# Bucket sort uniform expects values in [0, 1)
|
|
422
397
|
arr = [0.5, 0.1, 0.9, 0.2, 0.7]
|
|
423
398
|
expected = sorted(arr)
|
|
424
399
|
self.assertEqual(bucket_sort_uniform(arr), expected)
|
|
425
400
|
|
|
426
401
|
def test_bogosort(self):
|
|
427
|
-
# Using a tiny/already-sorted list because bogosort is non-deterministic and can run indefinitely
|
|
428
402
|
self.assertEqual(bogosort([2, 1]), [1, 2])
|
|
429
403
|
|
|
430
404
|
def test_bead_sort(self):
|
|
@@ -432,7 +406,6 @@ class TestSort(unittest.TestCase):
|
|
|
432
406
|
expected = sorted(arr)
|
|
433
407
|
self.assertEqual(bead_sort(list(arr)), expected)
|
|
434
408
|
|
|
435
|
-
# Bead sort expects positive integers; raises ValueError on negative inputs
|
|
436
409
|
with self.assertRaises(ValueError):
|
|
437
410
|
bead_sort([-1, 2])
|
|
438
411
|
|
|
@@ -445,21 +418,17 @@ class TestStackily(unittest.TestCase):
|
|
|
445
418
|
self.assertTrue(self.stack.is_empty())
|
|
446
419
|
self.assertEqual(self.stack.size(), 0)
|
|
447
420
|
|
|
448
|
-
# Push
|
|
449
421
|
self.stack.push("item1")
|
|
450
422
|
self.stack.push("item2")
|
|
451
423
|
self.assertFalse(self.stack.is_empty())
|
|
452
424
|
self.assertEqual(self.stack.size(), 2)
|
|
453
425
|
|
|
454
|
-
# Peek
|
|
455
426
|
self.assertEqual(self.stack.peek(), "item2")
|
|
456
427
|
|
|
457
|
-
# Pop
|
|
458
428
|
self.stack.pop()
|
|
459
429
|
self.assertEqual(self.stack.size(), 1)
|
|
460
430
|
self.assertEqual(self.stack.peek(), "item1")
|
|
461
431
|
|
|
462
|
-
# To list
|
|
463
432
|
self.assertEqual(self.stack.to_list(), ["item1"])
|
|
464
433
|
|
|
465
434
|
|
inpspypi-1.0.2/.gitignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__pycache__
|
|
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
|