From a784abf1cb7e08452ecf90325693d9b336ee002b Mon Sep 17 00:00:00 2001 From: mcepl <> Date: Mar 22 2022 18:49:52 +0000 Subject: Update python-Dumper to version 1.2.0 / rev 2 via SR 963839 https://build.opensuse.org/request/show/963839 by user mcepl + dimstar_suse - Switch to the upstream tarball, when the repository is now finally tagged (gh#jric/Dumper.py#2). --- diff --git a/.files b/.files index 6dbbcfe..dcbdf7e 100644 Binary files a/.files and b/.files differ diff --git a/.rev b/.rev index fcb4a7d..abbc165 100644 --- a/.rev +++ b/.rev @@ -7,4 +7,14 @@ Initial packaging of Dumper 1.2.0 (boo#1190410). 944875 + + e84b6944875495f5b21e683adeab49d5 + 1.2.0 + + dimstar_suse + - Switch to the upstream tarball, when the repository is now + finally tagged (gh#jric/Dumper.py#2). + + 963839 + diff --git a/Dumper-1.2.0.tar.gz b/Dumper-1.2.0.tar.gz deleted file mode 120000 index 9ae8ea0..0000000 --- a/Dumper-1.2.0.tar.gz +++ /dev/null @@ -1 +0,0 @@ -/ipfs/bafkreibwudsroe4gezurwpe4hovak55utq7lub3cbp3o4bbx334xcw24re \ No newline at end of file diff --git a/Dumper.py-1.2.0.tar.gz b/Dumper.py-1.2.0.tar.gz new file mode 120000 index 0000000..ad0996c --- /dev/null +++ b/Dumper.py-1.2.0.tar.gz @@ -0,0 +1 @@ +/ipfs/bafkreifpjexn7v5p45whxcqsaicfedxbuo3gra4ee5qndm76iicpjcf5qu \ No newline at end of file diff --git a/python-Dumper.changes b/python-Dumper.changes index 334a2f3..0cc9456 100644 --- a/python-Dumper.changes +++ b/python-Dumper.changes @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Tue Mar 22 07:39:54 UTC 2022 - Matej Cepl + +- Switch to the upstream tarball, when the repository is now + finally tagged (gh#jric/Dumper.py#2). + +------------------------------------------------------------------- Sat Jan 8 08:03:17 UTC 2022 - Matej Cepl - Add test.py and run tests. diff --git a/python-Dumper.spec b/python-Dumper.spec index cf04dd6..ee3a778 100644 --- a/python-Dumper.spec +++ b/python-Dumper.spec @@ -23,8 +23,7 @@ Release: 0 Summary: Tool to conveniently describe any Python datastructure License: MIT URL: https://github.com/jric/Dumper.py -Source0: https://files.pythonhosted.org/packages/source/D/Dumper/Dumper-%{version}.tar.gz -Source1: https://raw.githubusercontent.com/jric/Dumper.py/master/test.py +Source: https://github.com/jric/Dumper.py/archive/refs/tags/%{version}.tar.gz#/Dumper.py-%{version}.tar.gz BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -35,8 +34,7 @@ BuildArch: noarch Tool to conveniently describe any Python datastructure %prep -%setup -q -n Dumper-%{version} -cp %{SOURCE1} . +%setup -q -n Dumper.py-%{version} %build %python_build diff --git a/test.py b/test.py deleted file mode 100644 index 8d88712..0000000 --- a/test.py +++ /dev/null @@ -1,118 +0,0 @@ -from __future__ import print_function -from dumper import dump, dumps, Dumper -import dumper -import io -import sys - -buff = io.StringIO() -dumper.default_dumper = Dumper(output=buff) - -# BEGIN TEST CASES - -def do_dump_scalars(): - dump(1) - dump('a') - dump("foo") - dump('''string -with a newline''') - return "1'a''foo''string\\nwith a newline'" - -def test_do_dump_scalars(): - assert_output_as_expected(do_dump_scalars) - -def do_dumps_multi_values(): - s = dumps(1, " is less than ", 10) # returns unicode string in py2 - if sys.version < (3, 0): - s = s.encode('ascii', 'replace') # convert back to regular string - dump(s) - return "\"1' is less than '10\"" - -def test_dumps_multi_values(): - assert_output_as_expected(do_dumps_multi_values) - -def do_dump_json(): - obj = { - "httpCode": 200, - "extensionData": [ - { - "extensionValue": "egg" - } - ] - } - dump(obj) - return ''' -: - httpCode: 200 - extensionData: - 0: : - extensionValue: 'egg' -''' - -def test_do_dump_json(): - assert_output_matches_template(do_dump_json) - -# END TEST CASES - -def text_type(val): - if sys.version < '3': - return unicode(val) - else: - return str(val) - -def assertMatching(a, b): - ''' Asserts that the lines from string, a, match the lines in the string, b. - a is the expected string / pattern - b is the actual string - We ignore leading/trailing whitespace - ''' - a_lines = a.strip().split("\n") - b_lines = b.strip().split("\n") - if len(a_lines) != len(b_lines): - raise AssertionError("a has " + text_type(len(a_lines)) + ", but b has " + text_type(len(b_lines)) + " lines: a={" + a + "}, b={" + b + "}") - for i in range(0, len(a_lines)): - assert a_lines[i] == b_lines[i] - -def assert_output_matches_template(func): - # TODO: implement this - pass - -def assert_output_as_expected(func): - # buffer stdout - try: - output = func() - assertMatching(output, buff.getvalue()) - finally: - # reset the buffer for the next test - buff.truncate(0) - buff.seek(0) - -if __name__ == "__main__": - - l1 = [3, 5, 'hello'] - t1 = ('uh', 'oh') - l2 = ['foo', t1] - d1 = {'k1': 'val1', - 'k2': l1, - 'k2': l2} - - print("a list: ", dumps (l1), "; a tuple: ", dumps (t1)) - print("a complex list: ") - dump (l2) - dump (d1) - print("same dict, printed from dumps(): ") - print(dumps(d1)) - dump (19) - dump ("\nMy birth year!\n") - - dumper = Dumper (max_depth=1) - l = ['foo', ['bar', 'baz', (1, 2, 3)]] - dumper.dump (l) - dumper.max_depth = 2 - dumper.dump (l) - l[1][2] = tuple (range (11)) - dumper.dump (l) - dumper.max_depth = None - print(dumper.max_depth) - - class Foo: pass - class Bar: pass