# -*- coding: utf-8 -*- # Copyright (C) 2019-2020 Nexedi SA and Contributors. # Kirill Smelkov <*****@*****.**> # # This program is free software: you can Use, Study, Modify and Redistribute # it under the terms of the GNU General Public License version 3, or (at your # option) any later version, as published by the Free Software Foundation. # # You can also Link and Combine this program with other software covered by # the terms of any of the Free Software licenses or any of the Open Source # Initiative approved licenses and Convey the resulting work. Corresponding # source of such a combination shall include the source code for all other # software used. # # This program is distributed WITHOUT ANY WARRANTY; without even the implied # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # See COPYING file for full licensing terms. # See https://www.nexedi.com/licensing for rationale and options. from __future__ import print_function, absolute_import from golang.golang_test import import_pyx_tests import_pyx_tests("golang._strings_test")
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # See COPYING file for full licensing terms. # See https://www.nexedi.com/licensing for rationale and options. from __future__ import print_function, absolute_import from golang import go, chan, select, default from golang import sync, context, time from pytest import raises, mark from golang.golang_test import import_pyx_tests, panics from golang.time_test import dt from six.moves import range as xrange import sys, six import_pyx_tests("golang._sync_test") def _test_mutex(mu, lock, unlock): # verify that g2 mu.lock() blocks until g1 does mu.unlock() getattr(mu, lock)() l = [] done = chan() def _(): getattr(mu, lock)() l.append('b') getattr(mu, unlock)() done.close() go(_)
# -*- coding: utf-8 -*- # Copyright (C) 2019 Nexedi SA and Contributors. # Kirill Smelkov <*****@*****.**> # # This program is free software: you can Use, Study, Modify and Redistribute # it under the terms of the GNU General Public License version 3, or (at your # option) any later version, as published by the Free Software Foundation. # # You can also Link and Combine this program with other software covered by # the terms of any of the Free Software licenses or any of the Open Source # Initiative approved licenses and Convey the resulting work. Corresponding # source of such a combination shall include the source code for all other # software used. # # This program is distributed WITHOUT ANY WARRANTY; without even the implied # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # See COPYING file for full licensing terms. # See https://www.nexedi.com/licensing for rationale and options. from __future__ import print_function, absolute_import from golang.golang_test import import_pyx_tests import_pyx_tests("golang.pyx._runtime_test")
# # This program is distributed WITHOUT ANY WARRANTY; without even the implied # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # See COPYING file for full licensing terms. # See https://www.nexedi.com/licensing for rationale and options. from __future__ import print_function, absolute_import from golang import error from golang import errors, fmt, _fmt from golang.golang_test import import_pyx_tests from golang.errors_test import Unwrap1 from pytest import raises import_pyx_tests("golang._fmt_test") # verify fmt.Errorf with focus on %w (error chaining). # the rest of formatting is served by built-in python %. def test_errorf(): e = fmt.Errorf("abc") assert type(e) is error assert e.Error() == "abc" assert Unwrap1(e) is None e = fmt.Errorf("hello %d world %s", 123, "мир") assert type(e) is error assert e.Error() == "hello 123 world мир" assert Unwrap1(e) is None
# # This program is distributed WITHOUT ANY WARRANTY; without even the implied # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # See COPYING file for full licensing terms. # See https://www.nexedi.com/licensing for rationale and options. from __future__ import print_function, absolute_import from golang import error, b from golang import errors, _errors from golang.golang_test import import_pyx_tests from golang._errors_test import pyerror_mkchain as error_mkchain from pytest import raises import_pyx_tests("golang._errors_test") # assertEeq asserts that `e1 == e2`, `not (e1 != e2)`, `hash(e1) == hash(e2)`, # and symmetrically. def assertEeq(e1, e2): assert e1 == e2 assert e2 == e1 assert not (e1 != e2) assert not (e2 != e1) assert hash(e1) == hash(e2) assert hash(e2) == hash(e1) # assertEne asserts that `e1 != e2`, `not (e1 == e2)` and symmetrically. def assertEne(e1, e2):
# -*- coding: utf-8 -*- # Copyright (C) 2020 Nexedi SA and Contributors. # Kirill Smelkov <*****@*****.**> # # This program is free software: you can Use, Study, Modify and Redistribute # it under the terms of the GNU General Public License version 3, or (at your # option) any later version, as published by the Free Software Foundation. # # You can also Link and Combine this program with other software covered by # the terms of any of the Free Software licenses or any of the Open Source # Initiative approved licenses and Convey the resulting work. Corresponding # source of such a combination shall include the source code for all other # software used. # # This program is distributed WITHOUT ANY WARRANTY; without even the implied # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # See COPYING file for full licensing terms. # See https://www.nexedi.com/licensing for rationale and options. from __future__ import print_function, absolute_import from golang.golang_test import import_pyx_tests import_pyx_tests("golang._cxx_test")
# Kirill Smelkov <*****@*****.**> # # This program is free software: you can Use, Study, Modify and Redistribute # it under the terms of the GNU General Public License version 3, or (at your # option) any later version, as published by the Free Software Foundation. # # You can also Link and Combine this program with other software covered by # the terms of any of the Free Software licenses or any of the Open Source # Initiative approved licenses and Convey the resulting work. Corresponding # source of such a combination shall include the source code for all other # software used. # # This program is distributed WITHOUT ANY WARRANTY; without even the implied # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # See COPYING file for full licensing terms. # See https://www.nexedi.com/licensing for rationale and options. from __future__ import print_function, absolute_import from golang.golang_test import import_pyx_tests import_pyx_tests("golang._os_test") from golang._os_test import _test_os_fileio_cpp from golang import b # import_pyx_tests does not support passing fixtures into tests def test_pyx_os_fileio_cpp(tmp_path): _test_os_fileio_cpp(b(str(tmp_path)))