istr-python 1.0.4__tar.gz → 1.0.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: istr-python
3
- Version: 1.0.4
3
+ Version: 1.0.5
4
4
  Summary: istr - strings you can count on
5
5
  Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/salabim/istr
@@ -5,7 +5,7 @@
5
5
  # |_||___/ \__||_|
6
6
  # strings you can count on
7
7
 
8
- __version__ = "1.0.4"
8
+ __version__ = "1.0.5"
9
9
  import functools
10
10
  import math
11
11
  import copy
@@ -501,7 +501,7 @@ class istr(str):
501
501
  """
502
502
  key = (args, cls._base, cls._int_format, cls._repr_mode)
503
503
  if key in cls._digits_cache:
504
- return cls.digits_cache[key]
504
+ return cls._digits_cache[key]
505
505
  result = []
506
506
  if not args:
507
507
  args = ["0-9"]
@@ -539,7 +539,13 @@ class istr(str):
539
539
 
540
540
 
541
541
  def main():
542
- ...
542
+ print(istr.digits())
543
+
544
+ print(repr(istr.digits()))
545
+ print(int(istr.digits()))
546
+
547
+ with istr.base(16):
548
+ print(int(istr.digits()))
543
549
 
544
550
  if __name__ == "__main__":
545
551
  main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: istr-python
3
- Version: 1.0.4
3
+ Version: 1.0.5
4
4
  Summary: istr - strings you can count on
5
5
  Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/salabim/istr
@@ -8,7 +8,7 @@ authors = [
8
8
  {name = "Ruud van der Ham", email = "rt.van.der.ham@gmail.com"}
9
9
  ]
10
10
  description = "istr - strings you can count on"
11
- version = "1.0.4"
11
+ version = "1.0.5"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.7"
14
14
  dependencies = [
@@ -577,6 +577,18 @@ def test_digits():
577
577
  assert ef == 239
578
578
 
579
579
 
580
+ def test_digits_cache():
581
+ d = istr.digits()
582
+ assert id(d) == id(istr.digits())
583
+ assert int(d) == 123456789
584
+
585
+ with istr.base(16):
586
+ d = istr.digits()
587
+ assert id(d) == id(istr.digits())
588
+ assert int(d) == 4886718345
589
+
590
+
591
+
580
592
  def test_all_distinct():
581
593
  assert istr("abcdef").all_distinct()
582
594
  assert not istr("aabcdef").all_distinct()
File without changes
File without changes