aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2023-12-17 17:24:38 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2023-12-17 17:49:08 +0300
commit2db9050e1f36f97509ee51209ca9d171053b2cf9 (patch)
tree2bfa55beddb20fc8488e132485e9652ec511dd55
parentfceda2a88cb768432aaf4ceb0989602af2a10967 (diff)
downloadydb-2db9050e1f36f97509ee51209ca9d171053b2cf9.tar.gz
Intermediate changes
-rw-r--r--util/digest/multi_ut.pyx4
-rw-r--r--util/folder/path_ut.pyx268
-rw-r--r--util/generic/maybe_ut.pyx28
-rw-r--r--util/generic/string_ut.pyx112
-rw-r--r--util/memory/blob_ut.pyx130
-rw-r--r--util/string/cast_ut.pyx4
6 files changed, 273 insertions, 273 deletions
diff --git a/util/digest/multi_ut.pyx b/util/digest/multi_ut.pyx
index 26faa0069b2..a1f1bcbde76 100644
--- a/util/digest/multi_ut.pyx
+++ b/util/digest/multi_ut.pyx
@@ -9,11 +9,11 @@ class TestMultiHash(unittest.TestCase):
def test_str_int(self):
value = MultiHash(TString(b"1234567"), 123)
- self.assertEquals(value, 17038203285960021630)
+ self.assertEqual(value, 17038203285960021630)
def test_int_str(self):
value = MultiHash(123, TString(b"1234567"))
- self.assertEquals(value, 9973288649881090712)
+ self.assertEqual(value, 9973288649881090712)
def test_collision(self):
self.assertNotEquals(MultiHash(1, 1, 0), MultiHash(2, 2, 0))
diff --git a/util/folder/path_ut.pyx b/util/folder/path_ut.pyx
index e3b63f5c4c0..be8d3ce35af 100644
--- a/util/folder/path_ut.pyx
+++ b/util/folder/path_ut.pyx
@@ -14,37 +14,37 @@ class TestPath(unittest.TestCase):
def test_ctor1(self):
cdef TFsPath path = TFsPath()
self.assertEqual(path.IsDefined(), False)
- self.assertEquals(path.c_str(), "")
+ self.assertEqual(path.c_str(), "")
def test_ctor2(self):
cdef TString str_path = "/a/b/c"
cdef TFsPath path = TFsPath(str_path)
self.assertEqual(path.IsDefined(), True)
- self.assertEquals(path.c_str(), "/a/b/c")
+ self.assertEqual(path.c_str(), "/a/b/c")
def test_ctor3(self):
cdef TStringBuf buf_path = "/a/b/c"
cdef TFsPath path = TFsPath(buf_path)
self.assertEqual(path.IsDefined(), True)
- self.assertEquals(path.c_str(), "/a/b/c")
+ self.assertEqual(path.c_str(), "/a/b/c")
def test_ctor4(self):
cdef char* char_path = "/a/b/c"
cdef TFsPath path = TFsPath(char_path)
self.assertEqual(path.IsDefined(), True)
- self.assertEquals(path.c_str(), "/a/b/c")
+ self.assertEqual(path.c_str(), "/a/b/c")
def test_assignment(self):
cdef TFsPath path1 = TFsPath("/a/b")
cdef TFsPath path2 = TFsPath("/a/c")
- self.assertEquals(path1.GetPath(), "/a/b")
- self.assertEquals(path2.GetPath(), "/a/c")
+ self.assertEqual(path1.GetPath(), "/a/b")
+ self.assertEqual(path2.GetPath(), "/a/c")
path2 = path1
- self.assertEquals(path1.GetPath(), "/a/b")
- self.assertEquals(path2.GetPath(), "/a/b")
+ self.assertEqual(path1.GetPath(), "/a/b")
+ self.assertEqual(path2.GetPath(), "/a/b")
def test_check_defined(self):
cdef TFsPath path1 = TFsPath()
@@ -93,117 +93,117 @@ class TestPath(unittest.TestCase):
def test_fix(self):
cdef TFsPath path = TFsPath("test_fix/b/c/../d")
cdef TFsPath fixed = path.Fix()
- self.assertEquals(fixed.GetPath(), "test_fix/b/d")
+ self.assertEqual(fixed.GetPath(), "test_fix/b/d")
def test_parts(self):
cdef TFsPath path = TFsPath("/a/b/c")
- self.assertEquals(path.GetPath(), "/a/b/c")
- self.assertEquals(path.GetName(), "c")
- self.assertEquals(path.GetExtension(), "")
- self.assertEquals(path.Basename(), "c")
- self.assertEquals(path.Dirname(), "/a/b")
+ self.assertEqual(path.GetPath(), "/a/b/c")
+ self.assertEqual(path.GetName(), "c")
+ self.assertEqual(path.GetExtension(), "")
+ self.assertEqual(path.Basename(), "c")
+ self.assertEqual(path.Dirname(), "/a/b")
cdef TFsPath path_ext = TFsPath("/a/b/c.ext")
- self.assertEquals(path_ext.GetPath(), "/a/b/c.ext")
- self.assertEquals(path_ext.GetName(), "c.ext")
- self.assertEquals(path_ext.GetExtension(), "ext")
- self.assertEquals(path_ext.Basename(), "c.ext")
- self.assertEquals(path_ext.Dirname(), "/a/b")
+ self.assertEqual(path_ext.GetPath(), "/a/b/c.ext")
+ self.assertEqual(path_ext.GetName(), "c.ext")
+ self.assertEqual(path_ext.GetExtension(), "ext")
+ self.assertEqual(path_ext.Basename(), "c.ext")
+ self.assertEqual(path_ext.Dirname(), "/a/b")
cdef TFsPath path_only_ext = TFsPath("/a/b/.ext")
- self.assertEquals(path_only_ext.GetPath(), "/a/b/.ext")
- self.assertEquals(path_only_ext.GetName(), ".ext")
- self.assertEquals(path_only_ext.GetExtension(), "")
- self.assertEquals(path_only_ext.Basename(), ".ext")
- self.assertEquals(path_only_ext.Dirname(), "/a/b")
+ self.assertEqual(path_only_ext.GetPath(), "/a/b/.ext")
+ self.assertEqual(path_only_ext.GetName(), ".ext")
+ self.assertEqual(path_only_ext.GetExtension(), "")
+ self.assertEqual(path_only_ext.Basename(), ".ext")
+ self.assertEqual(path_only_ext.Dirname(), "/a/b")
cdef TFsPath path_dir = TFsPath("/a/b/")
- self.assertEquals(path_dir.GetPath(), "/a/b/")
- self.assertEquals(path_dir.GetName(), "b")
- self.assertEquals(path_dir.GetExtension(), "")
- self.assertEquals(path_dir.Basename(), "b")
- self.assertEquals(path_dir.Dirname(), "/a")
+ self.assertEqual(path_dir.GetPath(), "/a/b/")
+ self.assertEqual(path_dir.GetName(), "b")
+ self.assertEqual(path_dir.GetExtension(), "")
+ self.assertEqual(path_dir.Basename(), "b")
+ self.assertEqual(path_dir.Dirname(), "/a")
def test_absolute(self):
cdef TFsPath path_absolute = TFsPath("/a/b/c")
- self.assertEquals(path_absolute.IsAbsolute(), True)
- self.assertEquals(path_absolute.IsRelative(), False)
+ self.assertEqual(path_absolute.IsAbsolute(), True)
+ self.assertEqual(path_absolute.IsRelative(), False)
- self.assertEquals(path_absolute.IsSubpathOf(TFsPath("/a/b")), True)
- self.assertEquals(path_absolute.IsNonStrictSubpathOf(TFsPath("/a/b")), True)
- self.assertEquals(TFsPath("/a/b").IsContainerOf(path_absolute), True)
+ self.assertEqual(path_absolute.IsSubpathOf(TFsPath("/a/b")), True)
+ self.assertEqual(path_absolute.IsNonStrictSubpathOf(TFsPath("/a/b")), True)
+ self.assertEqual(TFsPath("/a/b").IsContainerOf(path_absolute), True)
- self.assertEquals(path_absolute.IsSubpathOf(TFsPath("/a/b/c")), False)
- self.assertEquals(path_absolute.IsNonStrictSubpathOf(TFsPath("/a/b/c")), True)
- self.assertEquals(TFsPath("/a/b/c").IsContainerOf(path_absolute), False)
+ self.assertEqual(path_absolute.IsSubpathOf(TFsPath("/a/b/c")), False)
+ self.assertEqual(path_absolute.IsNonStrictSubpathOf(TFsPath("/a/b/c")), True)
+ self.assertEqual(TFsPath("/a/b/c").IsContainerOf(path_absolute), False)
- self.assertEquals(path_absolute.IsSubpathOf(TFsPath("/a/c")), False)
- self.assertEquals(path_absolute.IsNonStrictSubpathOf(TFsPath("/a/c")), False)
- self.assertEquals(TFsPath("/a/c").IsContainerOf(path_absolute), False)
+ self.assertEqual(path_absolute.IsSubpathOf(TFsPath("/a/c")), False)
+ self.assertEqual(path_absolute.IsNonStrictSubpathOf(TFsPath("/a/c")), False)
+ self.assertEqual(TFsPath("/a/c").IsContainerOf(path_absolute), False)
with self.assertRaises(RuntimeError):
path_absolute.RelativeTo(TFsPath("/a/c"))
- self.assertEquals(path_absolute.RelativePath(TFsPath("/a/с")).GetPath(), "../b/c")
- self.assertEquals(path_absolute.RelativeTo(TFsPath("/a")).GetPath(), "b/c")
- self.assertEquals(path_absolute.RelativePath(TFsPath("/a")).GetPath(), "b/c")
- self.assertEquals(path_absolute.RelativeTo(TFsPath("/")).GetPath(), "a/b/c")
- self.assertEquals(path_absolute.RelativePath(TFsPath("/")).GetPath(), "a/b/c")
+ self.assertEqual(path_absolute.RelativePath(TFsPath("/a/с")).GetPath(), "../b/c")
+ self.assertEqual(path_absolute.RelativeTo(TFsPath("/a")).GetPath(), "b/c")
+ self.assertEqual(path_absolute.RelativePath(TFsPath("/a")).GetPath(), "b/c")
+ self.assertEqual(path_absolute.RelativeTo(TFsPath("/")).GetPath(), "a/b/c")
+ self.assertEqual(path_absolute.RelativePath(TFsPath("/")).GetPath(), "a/b/c")
with self.assertRaises(RuntimeError):
path_absolute.RelativeTo(TFsPath("./a"))
with self.assertRaises(RuntimeError):
path_absolute.RelativePath(TFsPath("d"))
- self.assertEquals(path_absolute.RelativePath(TFsPath("./a")).GetPath(), "b/c")
+ self.assertEqual(path_absolute.RelativePath(TFsPath("./a")).GetPath(), "b/c")
- self.assertEquals(path_absolute.Parent().GetPath(), "/a/b")
- self.assertEquals(path_absolute.Child("d").GetPath(), "/a/b/c/d")
+ self.assertEqual(path_absolute.Parent().GetPath(), "/a/b")
+ self.assertEqual(path_absolute.Child("d").GetPath(), "/a/b/c/d")
def test_relative(self):
cdef TFsPath path_relative_1 = TFsPath("a/b/c")
- self.assertEquals(path_relative_1.IsAbsolute(), False)
- self.assertEquals(path_relative_1.IsRelative(), True)
+ self.assertEqual(path_relative_1.IsAbsolute(), False)
+ self.assertEqual(path_relative_1.IsRelative(), True)
- self.assertEquals(path_relative_1.IsSubpathOf(TFsPath("a/b")), True)
- self.assertEquals(path_relative_1.IsNonStrictSubpathOf(TFsPath("a/b")), True)
- self.assertEquals(TFsPath("a/b").IsContainerOf(path_relative_1), True)
+ self.assertEqual(path_relative_1.IsSubpathOf(TFsPath("a/b")), True)
+ self.assertEqual(path_relative_1.IsNonStrictSubpathOf(TFsPath("a/b")), True)
+ self.assertEqual(TFsPath("a/b").IsContainerOf(path_relative_1), True)
- self.assertEquals(path_relative_1.IsSubpathOf(TFsPath("a/b/c")), False)
- self.assertEquals(path_relative_1.IsNonStrictSubpathOf(TFsPath("a/b/c")), True)
- self.assertEquals(TFsPath("a/b/c").IsContainerOf(path_relative_1), False)
+ self.assertEqual(path_relative_1.IsSubpathOf(TFsPath("a/b/c")), False)
+ self.assertEqual(path_relative_1.IsNonStrictSubpathOf(TFsPath("a/b/c")), True)
+ self.assertEqual(TFsPath("a/b/c").IsContainerOf(path_relative_1), False)
- self.assertEquals(path_relative_1.IsSubpathOf(TFsPath("a/c")), False)
- self.assertEquals(path_relative_1.IsNonStrictSubpathOf(TFsPath("a/c")), False)
- self.assertEquals(TFsPath("a/c").IsContainerOf(path_relative_1), False)
+ self.assertEqual(path_relative_1.IsSubpathOf(TFsPath("a/c")), False)
+ self.assertEqual(path_relative_1.IsNonStrictSubpathOf(TFsPath("a/c")), False)
+ self.assertEqual(TFsPath("a/c").IsContainerOf(path_relative_1), False)
- self.assertEquals(path_relative_1.Parent().GetPath(), "a/b")
- self.assertEquals(path_relative_1.Child("d").GetPath(), "a/b/c/d")
+ self.assertEqual(path_relative_1.Parent().GetPath(), "a/b")
+ self.assertEqual(path_relative_1.Child("d").GetPath(), "a/b/c/d")
cdef TFsPath path_relative_2 = TFsPath("./a/b/c")
- self.assertEquals(path_relative_2.IsAbsolute(), False)
- self.assertEquals(path_relative_2.IsRelative(), True)
+ self.assertEqual(path_relative_2.IsAbsolute(), False)
+ self.assertEqual(path_relative_2.IsRelative(), True)
- self.assertEquals(path_relative_2.IsSubpathOf(TFsPath("a/b")), True)
- self.assertEquals(path_relative_2.IsNonStrictSubpathOf(TFsPath("a/b")), True)
- self.assertEquals(TFsPath("a/b").IsContainerOf(path_relative_2), True)
+ self.assertEqual(path_relative_2.IsSubpathOf(TFsPath("a/b")), True)
+ self.assertEqual(path_relative_2.IsNonStrictSubpathOf(TFsPath("a/b")), True)
+ self.assertEqual(TFsPath("a/b").IsContainerOf(path_relative_2), True)
- self.assertEquals(path_relative_2.IsSubpathOf(TFsPath("a/b/c")), False)
- self.assertEquals(path_relative_2.IsNonStrictSubpathOf(TFsPath("a/b/c")), True)
- self.assertEquals(TFsPath("a/b/c").IsContainerOf(path_relative_2), False)
+ self.assertEqual(path_relative_2.IsSubpathOf(TFsPath("a/b/c")), False)
+ self.assertEqual(path_relative_2.IsNonStrictSubpathOf(TFsPath("a/b/c")), True)
+ self.assertEqual(TFsPath("a/b/c").IsContainerOf(path_relative_2), False)
- self.assertEquals(path_relative_2.IsSubpathOf(TFsPath("a/c")), False)
- self.assertEquals(path_relative_2.IsNonStrictSubpathOf(TFsPath("a/c")), False)
- self.assertEquals(TFsPath("a/c").IsContainerOf(path_relative_2), False)
+ self.assertEqual(path_relative_2.IsSubpathOf(TFsPath("a/c")), False)
+ self.assertEqual(path_relative_2.IsNonStrictSubpathOf(TFsPath("a/c")), False)
+ self.assertEqual(TFsPath("a/c").IsContainerOf(path_relative_2), False)
with self.assertRaises(RuntimeError):
path_relative_2.RelativeTo(TFsPath("a/c"))
- self.assertEquals(path_relative_2.RelativePath(TFsPath("a/с")).GetPath(), "../b/c")
- self.assertEquals(path_relative_2.RelativeTo(TFsPath("a")).GetPath(), "b/c")
- self.assertEquals(path_relative_2.RelativePath(TFsPath("a")).GetPath(), "b/c")
- self.assertEquals(path_relative_2.RelativeTo(TFsPath("./")).GetPath(), "a/b/c")
- self.assertEquals(path_relative_2.RelativePath(TFsPath("/a")).GetPath(), "b/c")
+ self.assertEqual(path_relative_2.RelativePath(TFsPath("a/с")).GetPath(), "../b/c")
+ self.assertEqual(path_relative_2.RelativeTo(TFsPath("a")).GetPath(), "b/c")
+ self.assertEqual(path_relative_2.RelativePath(TFsPath("a")).GetPath(), "b/c")
+ self.assertEqual(path_relative_2.RelativeTo(TFsPath("./")).GetPath(), "a/b/c")
+ self.assertEqual(path_relative_2.RelativePath(TFsPath("/a")).GetPath(), "b/c")
with self.assertRaises(RuntimeError):
- self.assertEquals(path_relative_2.RelativePath(TFsPath("./")).GetPath(), "a/b/c")
+ self.assertEqual(path_relative_2.RelativePath(TFsPath("./")).GetPath(), "a/b/c")
with self.assertRaises(RuntimeError):
path_relative_2.RelativeTo(TFsPath("/d"))
@@ -212,8 +212,8 @@ class TestPath(unittest.TestCase):
with self.assertRaises(RuntimeError):
path_relative_2.RelativePath(TFsPath("/"))
- self.assertEquals(path_relative_2.Parent().GetPath(), "a/b")
- self.assertEquals(path_relative_2.Child("d").GetPath(), "a/b/c/d")
+ self.assertEqual(path_relative_2.Parent().GetPath(), "a/b")
+ self.assertEqual(path_relative_2.Child("d").GetPath(), "a/b/c/d")
def test_mkdir(self):
cdef TFsPath directory = TFsPath("test_mkdir")
@@ -236,16 +236,16 @@ class TestPath(unittest.TestCase):
dir.List(files)
dir.ListNames(names)
- self.assertEquals(files.size(), 2)
- self.assertEquals(sorted([files[0].GetPath(), files[1].GetPath()]), ["test_list/b", "test_list/c"])
- self.assertEquals(names.size(), 2)
- self.assertEquals(sorted(list(names)), ["b", "c"])
+ self.assertEqual(files.size(), 2)
+ self.assertEqual(sorted([files[0].GetPath(), files[1].GetPath()]), ["test_list/b", "test_list/c"])
+ self.assertEqual(names.size(), 2)
+ self.assertEqual(sorted(list(names)), ["b", "c"])
def test_contains(self):
cdef TFsPath path = TFsPath("a/b/c")
- self.assertEquals(path.Contains("c"), True)
- self.assertEquals(path.Contains("b"), True)
- self.assertEquals(path.Contains("d"), False)
+ self.assertEqual(path.Contains("c"), True)
+ self.assertEqual(path.Contains("b"), True)
+ self.assertEqual(path.Contains("d"), False)
def test_delete(self):
cdef TFsPath root = TFsPath("/")
@@ -258,55 +258,55 @@ class TestPath(unittest.TestCase):
cdef TFsPath full = directory / directory
full.MkDirs()
- self.assertEquals(full.Exists(), True)
+ self.assertEqual(full.Exists(), True)
with self.assertRaises(RuntimeError):
directory.DeleteIfExists()
- self.assertEquals(directory.Exists(), True)
+ self.assertEqual(directory.Exists(), True)
directory.ForceDelete()
- self.assertEquals(directory.Exists(), False)
+ self.assertEqual(directory.Exists(), False)
cdef TFsPath local_file = TFsPath("test_delete_1")
- self.assertEquals(local_file.Exists(), False)
+ self.assertEqual(local_file.Exists(), False)
local_file.DeleteIfExists()
- self.assertEquals(local_file.Exists(), False)
+ self.assertEqual(local_file.Exists(), False)
local_file.ForceDelete()
- self.assertEquals(local_file.Exists(), False)
+ self.assertEqual(local_file.Exists(), False)
local_file.Touch()
- self.assertEquals(local_file.Exists(), True)
+ self.assertEqual(local_file.Exists(), True)
local_file.DeleteIfExists()
- self.assertEquals(local_file.Exists(), False)
+ self.assertEqual(local_file.Exists(), False)
local_file.Touch()
- self.assertEquals(local_file.Exists(), True)
+ self.assertEqual(local_file.Exists(), True)
local_file.ForceDelete()
- self.assertEquals(local_file.Exists(), False)
+ self.assertEqual(local_file.Exists(), False)
full.MkDirs()
- self.assertEquals(full.Exists(), True)
+ self.assertEqual(full.Exists(), True)
full.DeleteIfExists()
- self.assertEquals(full.Exists(), False)
- self.assertEquals(directory.Exists(), True)
+ self.assertEqual(full.Exists(), False)
+ self.assertEqual(directory.Exists(), True)
directory.DeleteIfExists()
- self.assertEquals(directory.Exists(), False)
+ self.assertEqual(directory.Exists(), False)
def test_checks(self):
cdef TFsPath local_file = TFsPath("test_checks")
with self.assertRaises(RuntimeError):
local_file.CheckExists()
local_file.Touch()
- self.assertEquals(local_file.Exists(), True)
- self.assertEquals(local_file.IsDirectory(), False)
- self.assertEquals(local_file.IsFile(), True)
- self.assertEquals(local_file.IsSymlink(), False)
+ self.assertEqual(local_file.Exists(), True)
+ self.assertEqual(local_file.IsDirectory(), False)
+ self.assertEqual(local_file.IsFile(), True)
+ self.assertEqual(local_file.IsSymlink(), False)
local_file.CheckExists()
local_file.DeleteIfExists()
local_file.MkDir()
- self.assertEquals(local_file.Exists(), True)
- self.assertEquals(local_file.IsDirectory(), True)
- self.assertEquals(local_file.IsFile(), False)
- self.assertEquals(local_file.IsSymlink(), False)
+ self.assertEqual(local_file.Exists(), True)
+ self.assertEqual(local_file.IsDirectory(), True)
+ self.assertEqual(local_file.IsFile(), False)
+ self.assertEqual(local_file.IsSymlink(), False)
local_file.CheckExists()
def test_rename(self):
@@ -315,29 +315,29 @@ class TestPath(unittest.TestCase):
cdef TString path_str = "test_rename_b"
cdef TFsPath path_from_str = TFsPath(path_str)
- self.assertEquals(path.Exists(), True)
- self.assertEquals(path_from_str.Exists(), False)
+ self.assertEqual(path.Exists(), True)
+ self.assertEqual(path_from_str.Exists(), False)
path.RenameTo(path_str)
- self.assertEquals(path.Exists(), False)
- self.assertEquals(path_from_str.Exists(), True)
+ self.assertEqual(path.Exists(), False)
+ self.assertEqual(path_from_str.Exists(), True)
cdef const char* path_char = "test_rename_c"
cdef TFsPath path_from_char = TFsPath(path_char)
- self.assertEquals(path_from_str.Exists(), True)
- self.assertEquals(path_from_char.Exists(), False)
+ self.assertEqual(path_from_str.Exists(), True)
+ self.assertEqual(path_from_char.Exists(), False)
path_from_str.RenameTo(path_char)
- self.assertEquals(path_from_str.Exists(), False)
- self.assertEquals(path_from_char.Exists(), True)
+ self.assertEqual(path_from_str.Exists(), False)
+ self.assertEqual(path_from_char.Exists(), True)
path_from_char.RenameTo(path)
- self.assertEquals(path_from_char.Exists(), False)
- self.assertEquals(path.Exists(), True)
+ self.assertEqual(path_from_char.Exists(), False)
+ self.assertEqual(path.Exists(), True)
path.ForceRenameTo(path_str)
- self.assertEquals(path_from_str.Exists(), True)
- self.assertEquals(path.Exists(), False)
+ self.assertEqual(path_from_str.Exists(), True)
+ self.assertEqual(path.Exists(), False)
with self.assertRaises(RuntimeError):
path_from_str.RenameTo("")
@@ -346,35 +346,35 @@ class TestPath(unittest.TestCase):
cdef TString dst = "test_copy_dst"
cdef TFsPath src_path = TFsPath("test_copy_src")
cdef TFsPath dst_path = TFsPath(dst)
- self.assertEquals(src_path.Exists(), False)
+ self.assertEqual(src_path.Exists(), False)
src_path.Touch()
- self.assertEquals(src_path.Exists(), True)
+ self.assertEqual(src_path.Exists(), True)
src_path.CopyTo(dst, False)
- self.assertEquals(src_path.Exists(), True)
- self.assertEquals(dst_path.Exists(), True)
+ self.assertEqual(src_path.Exists(), True)
+ self.assertEqual(dst_path.Exists(), True)
def test_real_path(self):
cdef TFsPath path = TFsPath("test_real_path_a")
path.Touch()
real_work_path = os.path.join(os.path.realpath(yatest.common.work_path()), "test_real_path_a")
- self.assertEquals(path.RealPath().GetPath(), real_work_path)
- self.assertEquals(path.RealLocation().GetPath(), real_work_path)
+ self.assertEqual(path.RealPath().GetPath(), real_work_path)
+ self.assertEqual(path.RealLocation().GetPath(), real_work_path)
with self.assertRaises(RuntimeError):
path.ReadLink()
def test_cwd(self):
cdef TFsPath path = TFsPath.Cwd()
- self.assertEquals(path.GetPath(), os.path.realpath(yatest.common.work_path()))
+ self.assertEqual(path.GetPath(), os.path.realpath(yatest.common.work_path()))
def test_swap(self):
cdef TFsPath first = TFsPath("first")
cdef TFsPath second = TFsPath("second")
- self.assertEquals(first.GetPath(), "first")
- self.assertEquals(second.GetPath(), "second")
+ self.assertEqual(first.GetPath(), "first")
+ self.assertEqual(second.GetPath(), "second")
first.Swap(second)
- self.assertEquals(first.GetPath(), "second")
- self.assertEquals(second.GetPath(), "first")
+ self.assertEqual(first.GetPath(), "second")
+ self.assertEqual(second.GetPath(), "first")
second.Swap(first)
- self.assertEquals(first.GetPath(), "first")
- self.assertEquals(second.GetPath(), "second")
+ self.assertEqual(first.GetPath(), "first")
+ self.assertEqual(second.GetPath(), "second")
diff --git a/util/generic/maybe_ut.pyx b/util/generic/maybe_ut.pyx
index 2de185c8075..c514d9b62c0 100644
--- a/util/generic/maybe_ut.pyx
+++ b/util/generic/maybe_ut.pyx
@@ -27,7 +27,7 @@ class TestMaybe(unittest.TestCase):
def test_ctor2(self):
cdef TMaybe[int] tmp = TMaybe[int](42)
self.assertTrue(tmp.Defined())
- self.assertEquals(tmp.GetRef(), 42)
+ self.assertEqual(tmp.GetRef(), 42)
def test_ctor3(self):
cdef TMaybe[int] tmp = Nothing()
@@ -37,7 +37,7 @@ class TestMaybe(unittest.TestCase):
cdef TMaybe[int] tmp
tmp = 42
self.assertTrue(tmp.Defined())
- self.assertEquals(tmp.GetRef(), 42)
+ self.assertEqual(tmp.GetRef(), 42)
def test_compare(self):
cdef TMaybe[int] tmp1 = 17
@@ -114,7 +114,7 @@ class TestMaybe(unittest.TestCase):
cdef TMaybe[int] tmp
tmp.ConstructInPlace(42)
self.assertTrue(tmp.Defined())
- self.assertEquals(tmp.GetRef(), 42)
+ self.assertEqual(tmp.GetRef(), 42)
def test_clear(self):
cdef TMaybe[int] tmp = 42
@@ -140,38 +140,38 @@ class TestMaybe(unittest.TestCase):
cdef TMaybe[int] tmp = 42
cdef int* p = tmp.Get()
self.assertTrue(p != NULL)
- self.assertEquals(p[0], 42)
+ self.assertEqual(p[0], 42)
def test_get_ref(self):
cdef TMaybe[int] tmp = 42
self.assertTrue(tmp.Defined())
- self.assertEquals(tmp.GetRef(), 42)
+ self.assertEqual(tmp.GetRef(), 42)
def test_get_or_else(self):
cdef TMaybe[int] tmp = 42
- self.assertEquals(tmp.GetOrElse(13), 42)
+ self.assertEqual(tmp.GetOrElse(13), 42)
tmp.Clear()
- self.assertEquals(tmp.GetOrElse(13), 13)
+ self.assertEqual(tmp.GetOrElse(13), 13)
def test_or_else(self):
cdef TMaybe[int] tmp = 42
cdef TMaybe[int] nothing
self.assertFalse(nothing.OrElse(nothing).Defined())
- self.assertEquals(tmp.OrElse(nothing).GetRef(), 42)
- self.assertEquals(nothing.OrElse(tmp).GetRef(), 42)
- self.assertEquals(tmp.OrElse(tmp).GetRef(), 42)
+ self.assertEqual(tmp.OrElse(nothing).GetRef(), 42)
+ self.assertEqual(nothing.OrElse(tmp).GetRef(), 42)
+ self.assertEqual(tmp.OrElse(tmp).GetRef(), 42)
def test_cast(self):
cdef TMaybe[int] tmp = 42
cdef TMaybe[char] tmp2 = tmp.Cast[char]()
- self.assertEquals(tmp2.GetRef(), 42)
+ self.assertEqual(tmp2.GetRef(), 42)
def test_swap(self):
cdef TMaybe[int] tmp1 = 42
cdef TMaybe[int] tmp2
tmp2.Swap(tmp1)
self.assertFalse(tmp1.Defined())
- self.assertEquals(tmp2.GetRef(), 42)
+ self.assertEqual(tmp2.GetRef(), 42)
def test_from_py(self):
self.assertTrue(_check_from_py(42))
@@ -181,5 +181,5 @@ class TestMaybe(unittest.TestCase):
_check_from_py("ttt")
def test_to_py(self):
- self.assertEquals(_check_to_py_value(), 42)
- self.assertEquals(_check_to_py_nothing(), None)
+ self.assertEqual(_check_to_py_value(), 42)
+ self.assertEqual(_check_to_py_nothing(), None)
diff --git a/util/generic/string_ut.pyx b/util/generic/string_ut.pyx
index 5407f5b4c12..36d5c6de242 100644
--- a/util/generic/string_ut.pyx
+++ b/util/generic/string_ut.pyx
@@ -12,44 +12,44 @@ import sys
class TestStroka(unittest.TestCase):
def test_unicode(self):
cdef TString x = "привет"
- self.assertEquals(x, "привет")
+ self.assertEqual(x, "привет")
def test_ctor1(self):
cdef TString tmp = TString()
cdef TString tmp2 = TString(tmp)
- self.assertEquals(tmp2, "")
+ self.assertEqual(tmp2, "")
def test_ctor2(self):
cdef std_string tmp = b"hello"
cdef TString tmp2 = TString(tmp)
- self.assertEquals(tmp2, "hello")
+ self.assertEqual(tmp2, "hello")
def test_ctor3(self):
cdef TString tmp = b"hello"
cdef TString tmp2 = TString(tmp, 0, 4)
- self.assertEquals(tmp2, "hell")
+ self.assertEqual(tmp2, "hell")
def test_ctor4(self):
cdef TString tmp = TString(<char*>b"hello")
- self.assertEquals(tmp, "hello")
+ self.assertEqual(tmp, "hello")
def test_ctor5(self):
cdef TString tmp = TString(<char*>b"hello", 4)
- self.assertEquals(tmp, "hell")
+ self.assertEqual(tmp, "hell")
def test_ctor6(self):
cdef TString tmp = TString(<char*>b"hello", 1, 3)
- self.assertEquals(tmp, "ell")
+ self.assertEqual(tmp, "ell")
def test_ctor7(self):
cdef TString tmp = TString(3, <char>'x')
- self.assertEquals(tmp, "xxx")
+ self.assertEqual(tmp, "xxx")
def test_ctor8(self):
cdef bytes tmp = b"hello"
cdef TString tmp2 = TString(<char*>tmp, <char*>tmp + 4)
- self.assertEquals(tmp2, "hell")
+ self.assertEqual(tmp2, "hell")
def test_compare(self):
cdef TString tmp1 = b"abacab"
@@ -72,31 +72,31 @@ class TestStroka(unittest.TestCase):
def test_operator_assign(self):
cdef TString tmp = b"hello"
cdef TString tmp2 = tmp
- self.assertEquals(tmp2, "hello")
+ self.assertEqual(tmp2, "hello")
def test_operator_plus(self):
cdef TString tmp = TString(b"hello ") + TString(b"world")
- self.assertEquals(tmp, "hello world")
+ self.assertEqual(tmp, "hello world")
def test_c_str(self):
cdef TString tmp = b"hello"
if sys.version_info.major == 2:
- self.assertEquals(bytes(tmp.c_str()), b"hello")
+ self.assertEqual(bytes(tmp.c_str()), b"hello")
else:
- self.assertEquals(bytes(tmp.c_str(), 'utf8'), b"hello")
+ self.assertEqual(bytes(tmp.c_str(), 'utf8'), b"hello")
def test_length(self):
cdef TString tmp = b"hello"
- self.assertEquals(tmp.size(), tmp.length())
+ self.assertEqual(tmp.size(), tmp.length())
def test_index(self):
cdef TString tmp = b"hello"
- self.assertEquals(<bytes>tmp[0], b'h')
- self.assertEquals(<bytes>tmp.at(0), b'h')
+ self.assertEqual(<bytes>tmp[0], b'h')
+ self.assertEqual(<bytes>tmp.at(0), b'h')
- self.assertEquals(<bytes>tmp[4], b'o')
- self.assertEquals(<bytes>tmp.at(4), b'o')
+ self.assertEqual(<bytes>tmp[4], b'o')
+ self.assertEqual(<bytes>tmp.at(4), b'o')
# Actually, TString::at() is noexcept
# with pytest.raises(IndexError):
@@ -107,119 +107,119 @@ class TestStroka(unittest.TestCase):
cdef TString tmp2 = b"fuu"
tmp.append(tmp2)
- self.assertEquals(tmp, "fuu")
+ self.assertEqual(tmp, "fuu")
tmp.append(tmp2, 1, 2)
- self.assertEquals(tmp, "fuuuu")
+ self.assertEqual(tmp, "fuuuu")
tmp.append(<char*>"ll ")
- self.assertEquals(tmp, "fuuuull ")
+ self.assertEqual(tmp, "fuuuull ")
tmp.append(<char*>"of greatness", 4)
- self.assertEquals(tmp, "fuuuull of g")
+ self.assertEqual(tmp, "fuuuull of g")
tmp.append(2, <char>b'o')
- self.assertEquals(tmp, "fuuuull of goo")
+ self.assertEqual(tmp, "fuuuull of goo")
tmp.push_back(b'z')
- self.assertEquals(tmp, "fuuuull of gooz")
+ self.assertEqual(tmp, "fuuuull of gooz")
def test_assign(self):
cdef TString tmp
tmp.assign(b"one")
- self.assertEquals(tmp, "one")
+ self.assertEqual(tmp, "one")
tmp.assign(b"two hundred", 0, 3)
- self.assertEquals(tmp, "two")
+ self.assertEqual(tmp, "two")
tmp.assign(<char*>b"three")
- self.assertEquals(tmp, "three")
+ self.assertEqual(tmp, "three")
tmp.assign(<char*>b"three fiddy", 5)
- self.assertEquals(tmp, "three")
+ self.assertEqual(tmp, "three")
def test_insert(self):
cdef TString tmp
tmp = b"xx"
tmp.insert(1, b"foo")
- self.assertEquals(tmp, "xfoox")
+ self.assertEqual(tmp, "xfoox")
tmp = b"xx"
tmp.insert(1, b"haxor", 1, 3)
- self.assertEquals(tmp, "xaxox")
+ self.assertEqual(tmp, "xaxox")
tmp = b"xx"
tmp.insert(1, <char*>b"foo")
- self.assertEquals(tmp, "xfoox")
+ self.assertEqual(tmp, "xfoox")
tmp = b"xx"
tmp.insert(1, <char*>b"foozzy", 3)
- self.assertEquals(tmp, "xfoox")
+ self.assertEqual(tmp, "xfoox")
tmp = b"xx"
tmp.insert(1, 2, <char>b'u')
- self.assertEquals(tmp, "xuux")
+ self.assertEqual(tmp, "xuux")
def test_copy(self):
cdef char buf[16]
cdef TString tmp = b"hello"
tmp.copy(buf, 5, 0)
- self.assertEquals(buf[:5], "hello")
+ self.assertEqual(buf[:5], "hello")
def test_find(self):
cdef TString haystack = b"whole lotta bytes"
cdef TString needle = "hole"
- self.assertEquals(haystack.find(needle), 1)
- self.assertEquals(haystack.find(needle, 3), npos)
+ self.assertEqual(haystack.find(needle), 1)
+ self.assertEqual(haystack.find(needle, 3), npos)
- self.assertEquals(haystack.find(<char>b'h'), 1)
- self.assertEquals(haystack.find(<char>b'h', 3), npos)
+ self.assertEqual(haystack.find(<char>b'h'), 1)
+ self.assertEqual(haystack.find(<char>b'h', 3), npos)
def test_rfind(self):
cdef TString haystack = b"whole lotta bytes"
cdef TString needle = b"hole"
- self.assertEquals(haystack.rfind(needle), 1)
- self.assertEquals(haystack.rfind(needle, 0), npos)
+ self.assertEqual(haystack.rfind(needle), 1)
+ self.assertEqual(haystack.rfind(needle, 0), npos)
- self.assertEquals(haystack.rfind(<char>b'h'), 1)
- self.assertEquals(haystack.rfind(<char>b'h', 0), npos)
+ self.assertEqual(haystack.rfind(<char>b'h'), 1)
+ self.assertEqual(haystack.rfind(<char>b'h', 0), npos)
def test_find_first_of(self):
cdef TString haystack = b"whole lotta bytes"
cdef TString cset = b"hxz"
- self.assertEquals(haystack.find_first_of(<char>b'h'), 1)
- self.assertEquals(haystack.find_first_of(<char>b'h', 3), npos)
+ self.assertEqual(haystack.find_first_of(<char>b'h'), 1)
+ self.assertEqual(haystack.find_first_of(<char>b'h', 3), npos)
- self.assertEquals(haystack.find_first_of(cset), 1)
- self.assertEquals(haystack.find_first_of(cset, 3), npos)
+ self.assertEqual(haystack.find_first_of(cset), 1)
+ self.assertEqual(haystack.find_first_of(cset, 3), npos)
def test_first_not_of(self):
cdef TString haystack = b"whole lotta bytes"
cdef TString cset = b"wxz"
- self.assertEquals(haystack.find_first_not_of(<char>b'w'), 1)
- self.assertEquals(haystack.find_first_not_of(<char>b'w', 3), 3)
+ self.assertEqual(haystack.find_first_not_of(<char>b'w'), 1)
+ self.assertEqual(haystack.find_first_not_of(<char>b'w', 3), 3)
- self.assertEquals(haystack.find_first_not_of(cset), 1)
- self.assertEquals(haystack.find_first_not_of(cset, 3), 3)
+ self.assertEqual(haystack.find_first_not_of(cset), 1)
+ self.assertEqual(haystack.find_first_not_of(cset, 3), 3)
def test_find_last_of(self):
cdef TString haystack = b"whole lotta bytes"
cdef TString cset = b"hxz"
- self.assertEquals(haystack.find_last_of(<char>b'h'), 1)
- self.assertEquals(haystack.find_last_of(<char>b'h', 0), npos)
+ self.assertEqual(haystack.find_last_of(<char>b'h'), 1)
+ self.assertEqual(haystack.find_last_of(<char>b'h', 0), npos)
- self.assertEquals(haystack.find_last_of(cset), 1)
- self.assertEquals(haystack.find_last_of(cset, 0), npos)
+ self.assertEqual(haystack.find_last_of(cset), 1)
+ self.assertEqual(haystack.find_last_of(cset, 0), npos)
def test_substr(self):
cdef TString tmp = b"foobar"
- self.assertEquals(tmp.substr(1), "oobar")
- self.assertEquals(tmp.substr(1, 4), "ooba")
+ self.assertEqual(tmp.substr(1), "oobar")
+ self.assertEqual(tmp.substr(1, 4), "ooba")
diff --git a/util/memory/blob_ut.pyx b/util/memory/blob_ut.pyx
index 2332e6fa206..35a72996de4 100644
--- a/util/memory/blob_ut.pyx
+++ b/util/memory/blob_ut.pyx
@@ -12,21 +12,21 @@ class TestBlob(unittest.TestCase):
def test_ctor(self):
cdef TBlob tmp = TBlob()
cdef TBlob tmp2 = TBlob(tmp)
- self.assertEquals(tmp.Size(), 0)
- self.assertEquals(tmp2.Size(), 0)
+ self.assertEqual(tmp.Size(), 0)
+ self.assertEqual(tmp2.Size(), 0)
def test_empty_data(self):
cdef TBlob tmp = TBlob()
- self.assertEquals(tmp.Data() == NULL, True)
- self.assertEquals(tmp.AsCharPtr() == NULL, True)
- self.assertEquals(tmp.AsUnsignedCharPtr() == NULL, True)
- self.assertEquals(tmp.Empty(), True)
- self.assertEquals(tmp.IsNull(), True)
+ self.assertEqual(tmp.Data() == NULL, True)
+ self.assertEqual(tmp.AsCharPtr() == NULL, True)
+ self.assertEqual(tmp.AsUnsignedCharPtr() == NULL, True)
+ self.assertEqual(tmp.Empty(), True)
+ self.assertEqual(tmp.IsNull(), True)
def test_empty_is_null(self):
cdef TBlob tmp = TBlob.NoCopy("", 0)
- self.assertEquals(tmp.Empty(), True)
- self.assertEquals(tmp.IsNull(), False)
+ self.assertEqual(tmp.Empty(), True)
+ self.assertEqual(tmp.IsNull(), False)
def test_data_types(self):
cdef const char* char_data = TBlob().AsCharPtr()
@@ -36,98 +36,98 @@ class TestBlob(unittest.TestCase):
def test_no_copy(self):
cdef const char* txt = "hello world"
cdef TBlob tmp = TBlob.NoCopy(txt, len(txt))
- self.assertEquals(tmp.AsCharPtr() - txt, 0)
- self.assertEquals(tmp.Size(), 11)
- self.assertEquals(tmp.AsCharPtr()[:tmp.Size()], "hello world")
- self.assertEquals(tmp.Empty(), False)
- self.assertEquals(tmp.IsNull(), False)
+ self.assertEqual(tmp.AsCharPtr() - txt, 0)
+ self.assertEqual(tmp.Size(), 11)
+ self.assertEqual(tmp.AsCharPtr()[:tmp.Size()], "hello world")
+ self.assertEqual(tmp.Empty(), False)
+ self.assertEqual(tmp.IsNull(), False)
def test_copy(self):
cdef const char* txt = "hello world"
cdef TBlob tmp = TBlob.Copy(txt, len(txt))
self.assertNotEquals(tmp.AsCharPtr() - txt, 0)
- self.assertEquals(tmp.Size(), 11)
- self.assertEquals(tmp.AsCharPtr()[:tmp.Size()], "hello world")
- self.assertEquals(tmp.Empty(), False)
- self.assertEquals(tmp.IsNull(), False)
+ self.assertEqual(tmp.Size(), 11)
+ self.assertEqual(tmp.AsCharPtr()[:tmp.Size()], "hello world")
+ self.assertEqual(tmp.Empty(), False)
+ self.assertEqual(tmp.IsNull(), False)
def test_from_string(self):
cdef TBlob tmp = TBlob.FromString(TString("hello world"))
- self.assertEquals(tmp.Size(), 11)
- self.assertEquals(tmp.AsCharPtr()[:tmp.Size()], "hello world")
- self.assertEquals(tmp.Empty(), False)
- self.assertEquals(tmp.IsNull(), False)
+ self.assertEqual(tmp.Size(), 11)
+ self.assertEqual(tmp.AsCharPtr()[:tmp.Size()], "hello world")
+ self.assertEqual(tmp.Empty(), False)
+ self.assertEqual(tmp.IsNull(), False)
def test_from_file(self):
with open("file", "w") as f:
f.write("hello world")
cdef TBlob tmp = TBlob.FromFile("file")
- self.assertEquals(tmp.Size(), 11)
- self.assertEquals(tmp.AsCharPtr()[:tmp.Size()], "hello world")
- self.assertEquals(tmp.Empty(), False)
- self.assertEquals(tmp.IsNull(), False)
+ self.assertEqual(tmp.Size(), 11)
+ self.assertEqual(tmp.AsCharPtr()[:tmp.Size()], "hello world")
+ self.assertEqual(tmp.Empty(), False)
+ self.assertEqual(tmp.IsNull(), False)
def test_precharged_from_file(self):
with open("precharged", "w") as f:
f.write("hello world")
cdef TBlob tmp = TBlob.PrechargedFromFile("precharged")
- self.assertEquals(tmp.Size(), 11)
- self.assertEquals(tmp.AsCharPtr()[:tmp.Size()], "hello world")
- self.assertEquals(tmp.Empty(), False)
- self.assertEquals(tmp.IsNull(), False)
+ self.assertEqual(tmp.Size(), 11)
+ self.assertEqual(tmp.AsCharPtr()[:tmp.Size()], "hello world")
+ self.assertEqual(tmp.Empty(), False)
+ self.assertEqual(tmp.IsNull(), False)
def test_swap_drop(self):
cdef TBlob tmp = TBlob.NoCopy("hello world", 11)
cdef TBlob tmp2
tmp2.Swap(tmp)
- self.assertEquals(tmp2.Size(), 11)
- self.assertEquals(tmp.Size(), 0)
- self.assertEquals(tmp2.AsCharPtr()[:tmp2.Size()], "hello world")
+ self.assertEqual(tmp2.Size(), 11)
+ self.assertEqual(tmp.Size(), 0)
+ self.assertEqual(tmp2.AsCharPtr()[:tmp2.Size()], "hello world")
tmp2.Swap(tmp)
- self.assertEquals(tmp2.Size(), 0)
- self.assertEquals(tmp.Size(), 11)
+ self.assertEqual(tmp2.Size(), 0)
+ self.assertEqual(tmp.Size(), 11)
tmp.Drop()
- self.assertEquals(tmp.Size(), 0)
+ self.assertEqual(tmp.Size(), 0)
def test_operator_brackets(self):
cdef TBlob tmp = TBlob.NoCopy("hello world", 11)
- self.assertEquals(tmp[0], ord('h'))
- self.assertEquals(tmp[1], ord('e'))
- self.assertEquals(tmp[2], ord('l'))
- self.assertEquals(tmp[3], ord('l'))
- self.assertEquals(tmp[4], ord('o'))
- self.assertEquals(tmp[5], ord(' '))
- self.assertEquals(tmp[6], ord('w'))
- self.assertEquals(tmp[7], ord('o'))
- self.assertEquals(tmp[8], ord('r'))
- self.assertEquals(tmp[9], ord('l'))
- self.assertEquals(tmp[10], ord('d'))
+ self.assertEqual(tmp[0], ord('h'))
+ self.assertEqual(tmp[1], ord('e'))
+ self.assertEqual(tmp[2], ord('l'))
+ self.assertEqual(tmp[3], ord('l'))
+ self.assertEqual(tmp[4], ord('o'))
+ self.assertEqual(tmp[5], ord(' '))
+ self.assertEqual(tmp[6], ord('w'))
+ self.assertEqual(tmp[7], ord('o'))
+ self.assertEqual(tmp[8], ord('r'))
+ self.assertEqual(tmp[9], ord('l'))
+ self.assertEqual(tmp[10], ord('d'))
def test_operator_equal(self):
cdef TBlob foo = TBlob.NoCopy("foo", 3)
cdef TBlob bar = TBlob.NoCopy("bar", 3)
- self.assertEquals(foo.AsCharPtr(), "foo")
- self.assertEquals(bar.AsCharPtr(), "bar")
+ self.assertEqual(foo.AsCharPtr(), "foo")
+ self.assertEqual(bar.AsCharPtr(), "bar")
bar = foo
- self.assertEquals(foo.AsCharPtr(), "foo")
- self.assertEquals(bar.AsCharPtr(), "foo")
+ self.assertEqual(foo.AsCharPtr(), "foo")
+ self.assertEqual(bar.AsCharPtr(), "foo")
def test_sub_blob(self):
cdef TBlob tmp = TBlob.NoCopy("hello world", 11)
- self.assertEquals(tmp.SubBlob(0).Size(), 0)
- self.assertEquals(tmp.SubBlob(1).Size(), 1)
- self.assertEquals(tmp.SubBlob(5).Size(), 5)
- self.assertEquals(tmp.AsCharPtr() - tmp.SubBlob(0).AsCharPtr(), 0)
+ self.assertEqual(tmp.SubBlob(0).Size(), 0)
+ self.assertEqual(tmp.SubBlob(1).Size(), 1)
+ self.assertEqual(tmp.SubBlob(5).Size(), 5)
+ self.assertEqual(tmp.AsCharPtr() - tmp.SubBlob(0).AsCharPtr(), 0)
- self.assertEquals(tmp.SubBlob(0, 0).Size(), 0)
- self.assertEquals(tmp.SubBlob(0, 1).Size(), 1)
- self.assertEquals(tmp.SubBlob(0, 5).Size(), 5)
- self.assertEquals(tmp.AsCharPtr() - tmp.SubBlob(0, 0).AsCharPtr(), 0)
+ self.assertEqual(tmp.SubBlob(0, 0).Size(), 0)
+ self.assertEqual(tmp.SubBlob(0, 1).Size(), 1)
+ self.assertEqual(tmp.SubBlob(0, 5).Size(), 5)
+ self.assertEqual(tmp.AsCharPtr() - tmp.SubBlob(0, 0).AsCharPtr(), 0)
- self.assertEquals(tmp.SubBlob(1, 1).Size(), 0)
- self.assertEquals(tmp.SubBlob(1, 2).Size(), 1)
- self.assertEquals(tmp.SubBlob(1, 6).Size(), 5)
- self.assertEquals(tmp.SubBlob(1, 1).AsCharPtr() - tmp.AsCharPtr(), 1)
+ self.assertEqual(tmp.SubBlob(1, 1).Size(), 0)
+ self.assertEqual(tmp.SubBlob(1, 2).Size(), 1)
+ self.assertEqual(tmp.SubBlob(1, 6).Size(), 5)
+ self.assertEqual(tmp.SubBlob(1, 1).AsCharPtr() - tmp.AsCharPtr(), 1)
with self.assertRaises(Exception):
tmp.SubBlob(2, 1)
@@ -135,7 +135,7 @@ class TestBlob(unittest.TestCase):
def test_deep_copy(self):
cdef TBlob tmp = TBlob.NoCopy("hello world", 11)
cdef TBlob tmp2 = tmp.DeepCopy()
- self.assertEquals(tmp.AsCharPtr()[:tmp.Size()], "hello world")
- self.assertEquals(tmp2.AsCharPtr()[:tmp2.Size()], "hello world")
+ self.assertEqual(tmp.AsCharPtr()[:tmp.Size()], "hello world")
+ self.assertEqual(tmp2.AsCharPtr()[:tmp2.Size()], "hello world")
self.assertNotEquals(tmp2.AsCharPtr() - tmp.AsCharPtr(), 0)
diff --git a/util/string/cast_ut.pyx b/util/string/cast_ut.pyx
index 88e86ef961e..be95ce76aac 100644
--- a/util/string/cast_ut.pyx
+++ b/util/string/cast_ut.pyx
@@ -6,8 +6,8 @@ import unittest
class TestFromString(unittest.TestCase):
def test_from_int(self):
- self.assertEquals(FromString[int]("42"), 42)
+ self.assertEqual(FromString[int]("42"), 42)
class TestToString(unittest.TestCase):
def test_from_int(self):
- self.assertEquals(ToString(42), "42")
+ self.assertEqual(ToString(42), "42")