diff --git a/tests/translate/convert/test_dtd2po.py b/tests/translate/convert/test_dtd2po.py index 5e0ea67a97..d45f56ae62 100644 --- a/tests/translate/convert/test_dtd2po.py +++ b/tests/translate/convert/test_dtd2po.py @@ -283,8 +283,7 @@ def test_preserving_spaces(self): print(repr(unit.source)) assert unit.source == " - with a newline and more text" - @staticmethod - def test_escaping_newline_tabs(): + def test_escaping_newline_tabs(self): """Test that we handle all kinds of newline permutations.""" dtdsource = '\n' converter = dtd2po.dtd2po() diff --git a/tests/translate/convert/test_po2oo.py b/tests/translate/convert/test_po2oo.py index d852956282..6695e995d4 100644 --- a/tests/translate/convert/test_po2oo.py +++ b/tests/translate/convert/test_po2oo.py @@ -69,8 +69,7 @@ def test_convertoo(self): newoo = self.convertoo(posource, ootemplate, language="zu") assert newoo.decode("utf-8") == ootemplate + ooexpected - @staticmethod - def test_pofilter(): + def test_pofilter(self): """Tests integration with pofilter.""" # Some bad po with a few errors: posource = b'#: sourcefile.bla#ID_NUMBER.txet.gnirts\nmsgid "Mistake."\nmsgstr " (fout) "' @@ -114,8 +113,7 @@ def test_roundtrip_spaces(self): self.check_roundtrip(" ") self.check_roundtrip("\u00a0") - @staticmethod - def test_default_timestamp(): + def test_default_timestamp(self): """Test to ensure that we revert to the default timestamp.""" oointro, oooutro = ( r"svx source\dialog\numpages.src 0 string RID_SVXPAGE_NUM_OPTIONS STR_BULLET 0 en-US Text ", @@ -133,8 +131,7 @@ def test_default_timestamp(): == oointro + "2002-02-02 02:02:02" + oooutro ) - @staticmethod - def test_escape_conversion(): + def test_escape_conversion(self): """Test to ensure that we convert escapes correctly.""" oosource = ( r"svx source\dialog\numpages.src 0 string RID_SVXPAGE_NUM_OPTIONS STR_BULLET 0 en-US Column1\tColumn2\r\n 2002-02-02 02:02:02" @@ -149,8 +146,7 @@ def test_escape_conversion(): ) assert b"\tKolom1\\tKolom2\\r\\n\t" in outputfile.getvalue() - @staticmethod - def test_helpcontent_escapes(): + def test_helpcontent_escapes(self): """Test to ensure that we convert helpcontent escapes correctly.""" # Note how this test specifically uses incorrect spacing in the # translation. The extra space before 'hid' and an extra space before @@ -178,8 +174,7 @@ def test_helpcontent_escapes(): in outputfile.getvalue() ) - @staticmethod - def test_helpcontent_escapes2(): + def test_helpcontent_escapes2(self): """Test to ensure that we convert helpcontent escapes correctly.""" oosource = ( r"helpcontent2 source\text\scalc\05\empty_cells.xhp 0 help par_id2629474 0 en-US A1: 2002-02-02 02:02:02" diff --git a/tests/translate/convert/test_po2php.py b/tests/translate/convert/test_po2php.py index 8b24718cf3..33d20b91e5 100644 --- a/tests/translate/convert/test_po2php.py +++ b/tests/translate/convert/test_po2php.py @@ -29,8 +29,7 @@ def merge2php(phpsource, posource): print(outputphp) return outputphp - @staticmethod - def test_convertphp(): + def test_convertphp(self): """Test convertphp helper.""" posource = """#: $lang['name'] msgid "value" @@ -47,8 +46,7 @@ def test_convertphp(): assert po2php.convertphp(inputfile, outputfile, templatefile) == 1 assert outputfile.getvalue() == phpexpected - @staticmethod - def test_convertphp_notemplate(): + def test_convertphp_notemplate(self): """Test convertphp helper without template.""" posource = """#: $lang['name'] msgid "value" @@ -59,8 +57,7 @@ def test_convertphp_notemplate(): with raises(ValueError): po2php.convertphp(inputfile, outputfile, None) - @staticmethod - def test_convertphp_empty_template(): + def test_convertphp_empty_template(self): """Test convertphp helper with empty translation.""" posource = """#: $lang['name'] msgid "value" diff --git a/tests/translate/lang/test_identify.py b/tests/translate/lang/test_identify.py index 5b3ac50c9d..53fc33c541 100644 --- a/tests/translate/lang/test_identify.py +++ b/tests/translate/lang/test_identify.py @@ -173,8 +173,7 @@ def test_identify_store(self): unit.target = TEXT_LIST[i] assert self.langident.identify_target_lang(langlist) == "de" - @staticmethod - def test_bad_init_data(): + def test_bad_init_data(self): """Test __init__ with bad conf files and data dirs.""" with raises(ValueError): LanguageIdentifier(model_dir="missing") diff --git a/tests/translate/misc/test_multistring.py b/tests/translate/misc/test_multistring.py index c87454fc38..9168ca2867 100644 --- a/tests/translate/misc/test_multistring.py +++ b/tests/translate/misc/test_multistring.py @@ -4,8 +4,7 @@ class TestMultistring: - @staticmethod - def test_constructor(): + def test_constructor(self): t = multistring.multistring s1 = t("test") assert type(s1) is t @@ -19,8 +18,7 @@ def test_constructor(): with pytest.raises(ValueError): t([]) - @staticmethod - def test_repr(): + def test_repr(self): t = multistring.multistring s1 = t("test") assert repr(s1) == "multistring(['test'])" @@ -30,8 +28,7 @@ def test_repr(): assert repr(s2) == "multistring(['test', 'mé'])" assert eval("multistring.%s" % repr(s2)) == s2 - @staticmethod - def test_replace(): + def test_replace(self): t = multistring.multistring s1 = t(["abcdef", "def"]) @@ -62,8 +59,7 @@ def test_replace(): result = s2.replace("e", "g", 1) assert result == t(["abcdgef", "dgef"]) - @staticmethod - def test_comparison(): + def test_comparison(self): t = multistring.multistring assert t("test") == "test" assert t("test").__cmp__("test") == 0 @@ -72,14 +68,12 @@ def test_comparison(): assert t("téßt") > "test" assert t("téßt").__cmp__("test") > 0 - @staticmethod - def test_coercion(): + def test_coercion(self): t = multistring.multistring assert str(t("test")) == "test" assert str(t("téßt")) == "téßt" - @staticmethod - def test_unicode_coercion(): + def test_unicode_coercion(self): t = multistring.multistring assert str(t("test")) == "test" assert str(t("test")) == "test" @@ -88,14 +82,12 @@ def test_unicode_coercion(): assert str(t(["téßt", "blāh"])) == "téßt" assert str(t(["téßt"])) == "téßt" - @staticmethod - def test_list_coercion(): + def test_list_coercion(self): t = multistring.multistring assert str([t("test")]) == "[multistring(['test'])]" assert str([t("tést")]) == "[multistring(['tést'])]" - @staticmethod - def test_multistring_hash(): + def test_multistring_hash(self): t = multistring.multistring foo = t(["foo", "bar"]) foodict = {foo: "baz"} diff --git a/tests/translate/misc/test_optrecurse.py b/tests/translate/misc/test_optrecurse.py index 8dbe095467..ce14539571 100644 --- a/tests/translate/misc/test_optrecurse.py +++ b/tests/translate/misc/test_optrecurse.py @@ -17,8 +17,7 @@ def test_splitext(self): print(fullpath) assert self.parser.splitext(fullpath) == (root, extension) - @staticmethod - def test_outputfile_receives_bytes(capsys): + def test_outputfile_receives_bytes(self, capsys): parser = optrecurse.RecursiveOptionParser({"txt": ("po", None)}) temp_file = NamedTemporaryFile(delete=False) diff --git a/tests/translate/misc/test_quote.py b/tests/translate/misc/test_quote.py index 3d056c0431..9180055db6 100644 --- a/tests/translate/misc/test_quote.py +++ b/tests/translate/misc/test_quote.py @@ -108,40 +108,34 @@ def test_stripcomment(): class TestEncoding: - @staticmethod - def test_javapropertiesencode(): + def test_javapropertiesencode(self): assert quote.javapropertiesencode("abc") == "abc" assert quote.javapropertiesencode("abcḓ") == r"abc\u1E13" assert quote.javapropertiesencode("abc\n") == "abc\\n" - @staticmethod - def test_java_utf8_properties_encode(): + def test_java_utf8_properties_encode(self): assert quote.java_utf8_properties_encode("abc") == "abc" assert quote.java_utf8_properties_encode("abcḓ") == "abcḓ" assert quote.java_utf8_properties_encode("abc\n") == "abc\\n" - @staticmethod - def test_escapespace(): + def test_escapespace(self): assert quote.escapespace(" ") == "\\u0020" assert quote.escapespace("\t") == "\\u0009" - @staticmethod - def test_mozillaescapemarginspaces(): + def test_mozillaescapemarginspaces(self): assert quote.mozillaescapemarginspaces(" ") == r"\u0020" assert quote.mozillaescapemarginspaces("A") == "A" assert quote.mozillaescapemarginspaces(" abc ") == r"\u0020abc\u0020" assert quote.mozillaescapemarginspaces(" abc ") == r"\u0020 abc\u0020" - @staticmethod - def test_mozilla_control_escapes(): + def test_mozilla_control_escapes(self): r"""Test that we do \uNNNN escapes for certain control characters instead of converting to UTF-8 characters.""" prefix, suffix = "bling", "blang" for control in ("\u0005", "\u0006", "\u0007", "\u0011"): string = prefix + control + suffix assert quote.escapecontrols(string) != string - @staticmethod - def test_propertiesdecode(): + def test_propertiesdecode(self): assert quote.propertiesdecode("abc") == "abc" assert quote.propertiesdecode("abc\\u1e13") == "abcḓ" assert quote.propertiesdecode("abc\\u1E13") == "abcḓ" @@ -149,8 +143,7 @@ def test_propertiesdecode(): assert quote.propertiesdecode("abc\\") == "abc\\" assert quote.propertiesdecode("abc\\") == "abc\\" - @staticmethod - def test_controlchars(): + def test_controlchars(self): assert quote.javapropertiesencode(quote.propertiesdecode("\u0001")) == r"\u0001" assert quote.javapropertiesencode(quote.propertiesdecode("\\u01")) == r"\u0001" assert quote.javapropertiesencode("\\") == "\\\\" @@ -158,8 +151,7 @@ def test_controlchars(): assert quote.propertiesdecode("\x01") == "\x01" assert quote.propertiesdecode("\\u0001") == "\x01" - @staticmethod - def test_properties_decode_slashu(): + def test_properties_decode_slashu(self): # The real input strings don't have double backslashes, but we have to # double them here because Python immediately decode them, even for raw # strings. @@ -180,8 +172,7 @@ def test_htmlencoding(self): raw_encoded = [("€", "€"), ("©", "©"), ('"', """)] self._html_encoding_helper(raw_encoded) - @staticmethod - def test_htmlencoding_existing_entities(): + def test_htmlencoding_existing_entities(self): """Test that we don't mess existing entities.""" assert quote.htmlentityencode("&") == "&" @@ -192,8 +183,7 @@ def test_htmlencoding_passthrough(self): ] # Raw text should have nothing done to it. self._html_encoding_helper(raw_encoded) - @staticmethod - def test_htmlencoding_nonentities(): + def test_htmlencoding_nonentities(self): """Tests to give us full coverage.""" for encoded, real in [ ("Some &; text", "Some &; text"), diff --git a/tests/translate/search/test_lshtein.py b/tests/translate/search/test_lshtein.py index 9f331f691d..fa79c995a6 100644 --- a/tests/translate/search/test_lshtein.py +++ b/tests/translate/search/test_lshtein.py @@ -4,8 +4,7 @@ class TestLevenshtein: """Test whether Levenshtein distance calculations are correct.""" - @staticmethod - def test_basic_distance(): + def test_basic_distance(self): """Tests distance correctness with a few basic values.""" assert lshtein.distance("word", "word") == 0 assert lshtein.distance("word", "") == 4 @@ -14,8 +13,7 @@ def test_basic_distance(): assert lshtein.distance("words", "word") == 1 assert lshtein.distance("word", "woord") == 1 - @staticmethod - def test_basic_similarity(): + def test_basic_similarity(self): """Tests similarity correctness with a few basic values.""" levenshtein = lshtein.LevenshteinComparer() assert levenshtein.similarity("word", "word") == 100 @@ -23,8 +21,7 @@ def test_basic_similarity(): assert levenshtein.similarity("word", "wood") == 75 assert levenshtein.similarity("aaa", "bbb", 0) == 0 - @staticmethod - def test_long_similarity(): + def test_long_similarity(self): """Tests that very long strings are handled well.""" # A sentence with 240 characters: sentence = "A long, dreary sentence about a cow that never new his mother. Actually it didn't known its father either. One day he decided that enough is enough, and that he would stop making long, dreary sentences just for the sake of making sentences." diff --git a/tests/translate/search/test_terminology.py b/tests/translate/search/test_terminology.py index da044e7ab4..217f211336 100644 --- a/tests/translate/search/test_terminology.py +++ b/tests/translate/search/test_terminology.py @@ -4,8 +4,7 @@ class TestTerminology: """Test terminology matching.""" - @staticmethod - def test_basic(): + def test_basic(self): """Tests basic functionality.""" termmatcher = terminology.TerminologyComparer() assert termmatcher.similarity("Open the file", "file") > 75 diff --git a/tests/translate/storage/placeables/test_base.py b/tests/translate/storage/placeables/test_base.py index e19431638f..2829c2cdff 100644 --- a/tests/translate/storage/placeables/test_base.py +++ b/tests/translate/storage/placeables/test_base.py @@ -182,8 +182,7 @@ def test_isleaf(self): for child in self.elem.sub: assert child.isleaf() - @staticmethod - def test_prune(): + def test_prune(self): elem = StringElem("foo") child = StringElem("bar") elem.sub.append(child) diff --git a/tests/translate/storage/test_factory.py b/tests/translate/storage/test_factory.py index 74aaaacfb2..437bc70eb3 100644 --- a/tests/translate/storage/test_factory.py +++ b/tests/translate/storage/test_factory.py @@ -44,8 +44,7 @@ def cleardir(dirname): os.rmdir(dirname) assert not os.path.exists(dirname) - @staticmethod - def test_getclass(): + def test_getclass(self): assert classname("file.po") == "pofile" assert classname("file.pot") == "pofile" assert classname("file.dtd.po") == "pofile" diff --git a/tests/translate/storage/test_fluent.py b/tests/translate/storage/test_fluent.py index 0a92532741..f386217884 100644 --- a/tests/translate/storage/test_fluent.py +++ b/tests/translate/storage/test_fluent.py @@ -3442,8 +3442,7 @@ def test_parse_errors(self): r"message = { -ref", ) - @staticmethod - def test_unit_ids(): + def test_unit_ids(self): """Test that setting valid ids is ok, and invalid ids are blocked.""" # Test valid ids. for fluent_type, unit_id in [ diff --git a/tests/translate/storage/test_html.py b/tests/translate/storage/test_html.py index 65ce2aa296..483f6b969f 100644 --- a/tests/translate/storage/test_html.py +++ b/tests/translate/storage/test_html.py @@ -57,14 +57,12 @@ def test_mismatched_tags(self): """
A caption
Heading OneHeading Two
Foot OneFoot Two
OneTwo
""" ) - @staticmethod - def test_self_closing_tags(): + def test_self_closing_tags(self): h = html.htmlfile() store = h.parsestring("

Some text

") assert len(store.units) == 1 - @staticmethod - def test_escaping_script_and_pre(): + def test_escaping_script_and_pre(self): """