summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2022-09-26 12:36:19 -0400
committerAllen Winter <allen.winter@kdab.com>2022-09-26 15:42:58 -0400
commitdf3fbd49a72bfb3521191ca434d4708b2d60abfd (patch)
treed99efa7c763d8f2e97a8bb0147311179745a1bb2
parent091ba2ab9934f66b1f195702c4be260f92040a85 (diff)
downloadlibical-git-df3fbd49a72bfb3521191ca434d4708b2d60abfd.tar.gz
src/test/libical-glib/*.py - pylint and autopep cleaning
-rw-r--r--.pre-commit-config.yaml2
-rw-r--r--.pylintrc571
-rw-r--r--.reuse/dep52
-rw-r--r--src/test/libical-glib/array.py94
-rw-r--r--src/test/libical-glib/attach.py29
-rw-r--r--src/test/libical-glib/component.py368
-rw-r--r--src/test/libical-glib/comprehensive.py125
-rw-r--r--src/test/libical-glib/duration.py41
-rw-r--r--src/test/libical-glib/error.py37
-rw-r--r--src/test/libical-glib/misc.py19
-rw-r--r--src/test/libical-glib/parameter.py85
-rw-r--r--src/test/libical-glib/period.py119
-rw-r--r--src/test/libical-glib/property.py157
-rw-r--r--src/test/libical-glib/recurrence.py86
-rw-r--r--src/test/libical-glib/timezone.py142
-rw-r--r--src/test/libical-glib/value.py101
16 files changed, 1005 insertions, 973 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 74f05462..20284a9c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -18,10 +18,12 @@ repos:
rev: v2.15.3
hooks:
- id: pylint
+ exclude: ^(src/python)
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.7.0
hooks:
- id: autopep8
+ exclude: ^(src/python)
- repo: https://github.com/codespell-project/codespell
rev: v2.2.1
hooks:
diff --git a/.pylintrc b/.pylintrc
index b3bb2f6d..c851378a 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -1,4 +1,22 @@
-[MASTER]
+[MAIN]
+
+# Analyse import fallback blocks. This can be used to support both Python 2 and
+# 3 compatible code, which means that the block might have code that exists
+# only in one or another interpreter, leading to false positives when analysed.
+analyse-fallback-blocks=no
+
+# Load and enable all available extensions. Use --list-extensions to see a list
+# all available extensions.
+#enable-all-extensions=
+
+# In error mode, messages with a category besides ERROR or FATAL are
+# suppressed, and no reports are done by default. Error mode is compatible with
+# disabling specific errors.
+#errors-only=
+
+# Always return a 0 (non-error) status code, even if lint errors are found.
+# This is primarily useful in continuous integration scripts.
+#exit-zero=
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
@@ -16,27 +34,40 @@ extension-pkg-whitelist=
# specified are enabled, while categories only check already-enabled messages.
fail-on=
-# Specify a score threshold to be exceeded before program exits with error.
-fail-under=10.0
+# Specify a score threshold under which the program will exit with error.
+fail-under=10
+
+# Interpret the stdin as a python script, whose filename needs to be passed as
+# the module_or_package argument.
+#from-stdin=
# Files or directories to be skipped. They should be base names, not paths.
ignore=CVS
-# Add files or directories matching the regex patterns to the ignore-list. The
-# regex matches against paths and can be in Posix or Windows format.
+# Add files or directories matching the regular expressions patterns to the
+# ignore-list. The regex matches against paths and can be in Posix or Windows
+# format. Because '\' represents the directory delimiter on Windows systems, it
+# can't be used as an escape character.
ignore-paths=
-# Files or directories matching the regex patterns are skipped. The regex
-# matches against base names, not paths. The default value ignores emacs file
-# locks
-ignore-patterns=^\.#
+# Files or directories matching the regular expression patterns are skipped.
+# The regex matches against base names, not paths. The default value ignores
+# Emacs file locks
+ignore-patterns=^\.#|.cmake-format.py
+
+# List of module names for which member attributes should not be checked
+# (useful for modules/projects where namespaces are manipulated during runtime
+# and thus existing member attributes cannot be deduced by static analysis). It
+# supports qualified module names, as well as Unix pattern matching.
+ignored-modules=gi
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
-# number of processors available to use.
+# number of processors available to use, and will cap the count on Windows to
+# avoid hangs.
jobs=1
# Control the amount of potential inferred values when inferring a single
@@ -66,13 +97,45 @@ suggestion-mode=yes
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
+# In verbose mode, extra non-checker-related info will be displayed.
+#verbose=
+
+
+[REPORTS]
+
+# Python expression which should return a score less than or equal to 10. You
+# have access to the variables 'fatal', 'error', 'warning', 'refactor',
+# 'convention', and 'info' which contain the number of messages in each
+# category, as well as 'statement' which is the total number of statements
+# analyzed. This score is used by the global evaluation report (RP0004).
+evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))
+
+# Template used to display messages. This is a python new-style format string
+# used to format the message information. See doc for all details.
+msg-template=
+
+# Set the output format. Available formats are text, parseable, colorized, json
+# and msvs (visual studio). You can also give a reporter class, e.g.
+# mypackage.mymodule.MyReporterClass.
+#output-format=
+
+# Tells whether to display a full report or only the messages.
+reports=no
+
+# Activate the evaluation score.
+score=yes
+
[MESSAGES CONTROL]
# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
# UNDEFINED.
-confidence=
+confidence=HIGH,
+ CONTROL_FLOW,
+ INFERENCE,
+ INFERENCE_FAILURE,
+ UNDEFINED
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
@@ -90,7 +153,9 @@ disable=raw-checker-failed,
suppressed-message,
useless-suppression,
deprecated-pragma,
- use-symbolic-message-instead
+ use-symbolic-message-instead,
+ unknown-option-value,
+ R0801
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
@@ -99,177 +164,52 @@ disable=raw-checker-failed,
enable=c-extension-no-member
-[REPORTS]
-
-# Python expression which should return a score less than or equal to 10. You
-# have access to the variables 'fatal', 'error', 'warning', 'refactor',
-# 'convention', and 'info' which contain the number of messages in each
-# category, as well as 'statement' which is the total number of statements
-# analyzed. This score is used by the global evaluation report (RP0004).
-evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))
-
-# Template used to display messages. This is a python new-style format string
-# used to format the message information. See doc for all details.
-#msg-template=
-
-# Set the output format. Available formats are text, parseable, colorized, json
-# and msvs (visual studio). You can also give a reporter class, e.g.
-# mypackage.mymodule.MyReporterClass.
-output-format=text
-
-# Tells whether to display a full report or only the messages.
-reports=no
-
-# Activate the evaluation score.
-score=yes
-
-
-[REFACTORING]
-
-# Maximum number of nested blocks for function / method body
-max-nested-blocks=5
-
-# Complete name of functions that never returns. When checking for
-# inconsistent-return-statements if a never returning function is called then
-# it will be considered as an explicit return statement and no message will be
-# printed.
-never-returning-functions=sys.exit,argparse.parse_error
-
-
-[BASIC]
-
-# Naming style matching correct argument names.
-argument-naming-style=snake_case
-
-# Regular expression matching correct argument names. Overrides argument-
-# naming-style. If left empty, argument names will be checked with the set
-# naming style.
-#argument-rgx=
-
-# Naming style matching correct attribute names.
-attr-naming-style=snake_case
-
-# Regular expression matching correct attribute names. Overrides attr-naming-
-# style. If left empty, attribute names will be checked with the set naming
-# style.
-#attr-rgx=
-
-# Bad variable names which should always be refused, separated by a comma.
-bad-names=foo,
- bar,
- baz,
- toto,
- tutu,
- tata
-
-# Bad variable names regexes, separated by a comma. If names match any regex,
-# they will always be refused
-bad-names-rgxs=
-
-# Naming style matching correct class attribute names.
-class-attribute-naming-style=any
-
-# Regular expression matching correct class attribute names. Overrides class-
-# attribute-naming-style. If left empty, class attribute names will be checked
-# with the set naming style.
-#class-attribute-rgx=
-
-# Naming style matching correct class constant names.
-class-const-naming-style=UPPER_CASE
-
-# Regular expression matching correct class constant names. Overrides class-
-# const-naming-style. If left empty, class constant names will be checked with
-# the set naming style.
-#class-const-rgx=
-
-# Naming style matching correct class names.
-class-naming-style=PascalCase
-
-# Regular expression matching correct class names. Overrides class-naming-
-# style. If left empty, class names will be checked with the set naming style.
-#class-rgx=
-
-# Naming style matching correct constant names.
-const-naming-style=UPPER_CASE
-
-# Regular expression matching correct constant names. Overrides const-naming-
-# style. If left empty, constant names will be checked with the set naming
-# style.
-#const-rgx=
-
-# Minimum line length for functions/classes that require docstrings, shorter
-# ones are exempt.
-docstring-min-length=-1
-
-# Naming style matching correct function names.
-function-naming-style=snake_case
-
-# Regular expression matching correct function names. Overrides function-
-# naming-style. If left empty, function names will be checked with the set
-# naming style.
-#function-rgx=
+[DESIGN]
-# Good variable names which should always be accepted, separated by a comma.
-good-names=i,
- j,
- k,
- ex,
- Run,
- _
+# List of regular expressions of class ancestor names to ignore when counting
+# public methods (see R0903)
+exclude-too-few-public-methods=
-# Good variable names regexes, separated by a comma. If names match any regex,
-# they will always be accepted
-good-names-rgxs=
+# List of qualified class names to ignore when counting class parents (see
+# R0901)
+ignored-parents=
-# Include a hint for the correct naming format with invalid-name.
-include-naming-hint=no
+# Maximum number of arguments for function / method.
+max-args=5
-# Naming style matching correct inline iteration names.
-inlinevar-naming-style=any
+# Maximum number of attributes for a class (see R0902).
+max-attributes=7
-# Regular expression matching correct inline iteration names. Overrides
-# inlinevar-naming-style. If left empty, inline iteration names will be checked
-# with the set naming style.
-#inlinevar-rgx=
+# Maximum number of boolean expressions in an if statement (see R0916).
+max-bool-expr=5
-# Naming style matching correct method names.
-method-naming-style=snake_case
+# Maximum number of branch for function / method body.
+max-branches=12
-# Regular expression matching correct method names. Overrides method-naming-
-# style. If left empty, method names will be checked with the set naming style.
-#method-rgx=
+# Maximum number of locals for function / method body.
+max-locals=15
-# Naming style matching correct module names.
-module-naming-style=snake_case
+# Maximum number of parents for a class (see R0901).
+max-parents=7
-# Regular expression matching correct module names. Overrides module-naming-
-# style. If left empty, module names will be checked with the set naming style.
-#module-rgx=
+# Maximum number of public methods for a class (see R0904).
+max-public-methods=20
-# Colon-delimited sets of names that determine each other's naming style when
-# the name regexes allow several styles.
-name-group=
+# Maximum number of return / yield for function / method body.
+max-returns=6
-# Regular expression which should only match function or class names that do
-# not require a docstring.
-no-docstring-rgx=^_
+# Maximum number of statements in function / method body.
+max-statements=50
-# List of decorators that produce properties, such as abc.abstractproperty. Add
-# to this list to register other decorators that produce valid properties.
-# These decorators are taken in consideration only for invalid-name.
-property-classes=abc.abstractproperty
+# Minimum number of public methods for a class (see R0903).
+min-public-methods=2
-# Regular expression matching correct type variable names. If left empty, type
-# variable names will be checked with the set naming style.
-#typevar-rgx=
-# Naming style matching correct variable names.
-variable-naming-style=snake_case
+[EXCEPTIONS]
-# Regular expression matching correct variable names. Overrides variable-
-# naming-style. If left empty, variable names will be checked with the set
-# naming style.
-#variable-rgx=
+# Exceptions that will emit a warning when caught.
+overgeneral-exceptions=BaseException,
+ Exception
[FORMAT]
@@ -288,7 +228,7 @@ indent-after-paren=4
indent-string=' '
# Maximum number of characters on a single line.
-max-line-length=100
+max-line-length=120
# Maximum number of lines in a module.
max-module-lines=1000
@@ -302,6 +242,42 @@ single-line-class-stmt=no
single-line-if-stmt=no
+[IMPORTS]
+
+# List of modules that can be imported at any level, not just the top level
+# one.
+allow-any-import-level=
+
+# Allow wildcard imports from modules that define __all__.
+allow-wildcard-with-all=no
+
+# Deprecated modules which should not be used, separated by a comma.
+deprecated-modules=
+
+# Output a graph (.gv or any supported image format) of external dependencies
+# to the given file (report RP0402 must not be disabled).
+ext-import-graph=
+
+# Output a graph (.gv or any supported image format) of all (i.e. internal and
+# external) dependencies to the given file (report RP0402 must not be
+# disabled).
+import-graph=
+
+# Output a graph (.gv or any supported image format) of internal dependencies
+# to the given file (report RP0402 must not be disabled).
+int-import-graph=
+
+# Force import order to recognize a module as part of the standard
+# compatibility libraries.
+known-standard-library=
+
+# Force import order to recognize a module as part of a third party library.
+known-third-party=enchant
+
+# Couples of modules and preferred modules, separated by a comma.
+preferred-modules=
+
+
[LOGGING]
# The type of string formatting that logging methods do. `old` means using %
@@ -313,6 +289,13 @@ logging-format-style=old
logging-modules=logging
+[METHOD_ARGS]
+
+# List of qualified names (i.e., library.method) which require a timeout
+# parameter e.g. 'requests.api.get,requests.api.post'
+timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request
+
+
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
@@ -321,7 +304,7 @@ notes=FIXME,
TODO
# Regular expression of note tags to take in consideration.
-#notes-rgx=
+notes-rgx=
[SIMILARITIES]
@@ -333,10 +316,10 @@ ignore-comments=yes
ignore-docstrings=yes
# Imports are removed from the similarity computation
-ignore-imports=no
+ignore-imports=yes
# Signatures are removed from the similarity computation
-ignore-signatures=no
+ignore-signatures=yes
# Minimum lines number of a similarity.
min-similarity-lines=4
@@ -357,7 +340,7 @@ max-spelling-suggestions=4
spelling-dict=
# List of comma separated words that should be considered directives if they
-# appear and the beginning of a comment and should not be checked.
+# appear at the beginning of a comment and should not be checked.
spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:
# List of comma separated words that should not be checked.
@@ -394,10 +377,6 @@ contextmanager-decorators=contextlib.contextmanager
# expressions are accepted.
generated-members=
-# Tells whether missing members accessed in mixin class should be ignored. A
-# class is considered mixin if its name matches the mixin-class-rgx option.
-ignore-mixin-members=yes
-
# Tells whether to warn about missing members when the owner of the attribute
# is inferred to be None.
ignore-none=yes
@@ -410,16 +389,16 @@ ignore-none=yes
# the rest of the inferred objects.
ignore-on-opaque-inference=yes
+# List of symbolic message names to ignore for Mixin members.
+ignored-checks-for-mixins=no-member,
+ not-async-context-manager,
+ not-context-manager,
+ attribute-defined-outside-init
+
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
-ignored-classes=optparse.Values,thread._local,_thread._local
-
-# List of module names for which member attributes should not be checked
-# (useful for modules/projects where namespaces are manipulated during runtime
-# and thus existing member attributes cannot be deduced by static analysis). It
-# supports qualified module names, as well as Unix pattern matching.
-ignored-modules=
+ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace
# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
@@ -433,8 +412,7 @@ missing-member-hint-distance=1
# showing a hint for a missing member.
missing-member-max-choices=1
-# Regex pattern to define which classes are considered mixins ignore-mixin-
-# members is set to 'yes'
+# Regex pattern to define which classes are considered mixins.
mixin-class-rgx=.*[Mm]ixin
# List of decorators that change the signature of a decorated function.
@@ -462,8 +440,7 @@ callbacks=cb_,
# not be used).
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
-# Argument names that match this expression will be ignored. Default to name
-# with leading underscore.
+# Argument names that match this expression will be ignored.
ignored-argument-names=_.*|^ignored_|^unused_
# Tells whether we should check for unused import in __init__ files.
@@ -474,117 +451,175 @@ init-import=no
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
-[CLASSES]
+[BASIC]
-# Warn about protected attribute access inside special methods
-check-protected-access-in-special-methods=no
+# Naming style matching correct argument names.
+argument-naming-style=snake_case
-# List of method names used to declare (i.e. assign) instance attributes.
-defining-attr-methods=__init__,
- __new__,
- setUp,
- __post_init__
+# Regular expression matching correct argument names. Overrides argument-
+# naming-style. If left empty, argument names will be checked with the set
+# naming style.
+#argument-rgx=
-# List of member names, which should be excluded from the protected access
-# warning.
-exclude-protected=_asdict,
- _fields,
- _replace,
- _source,
- _make
+# Naming style matching correct attribute names.
+attr-naming-style=snake_case
-# List of valid names for the first argument in a class method.
-valid-classmethod-first-arg=cls
+# Regular expression matching correct attribute names. Overrides attr-naming-
+# style. If left empty, attribute names will be checked with the set naming
+# style.
+#attr-rgx=
-# List of valid names for the first argument in a metaclass class method.
-valid-metaclass-classmethod-first-arg=cls
+# Bad variable names which should always be refused, separated by a comma.
+bad-names=foo,
+ bar,
+ baz,
+ toto,
+ tutu,
+ tata
+# Bad variable names regexes, separated by a comma. If names match any regex,
+# they will always be refused
+bad-names-rgxs=
-[DESIGN]
+# Naming style matching correct class attribute names.
+class-attribute-naming-style=any
-# List of regular expressions of class ancestor names to ignore when counting
-# public methods (see R0903)
-exclude-too-few-public-methods=
+# Regular expression matching correct class attribute names. Overrides class-
+# attribute-naming-style. If left empty, class attribute names will be checked
+# with the set naming style.
+#class-attribute-rgx=
-# List of qualified class names to ignore when counting class parents (see
-# R0901)
-ignored-parents=
+# Naming style matching correct class constant names.
+class-const-naming-style=UPPER_CASE
-# Maximum number of arguments for function / method.
-max-args=5
+# Regular expression matching correct class constant names. Overrides class-
+# const-naming-style. If left empty, class constant names will be checked with
+# the set naming style.
+#class-const-rgx=
-# Maximum number of attributes for a class (see R0902).
-max-attributes=7
+# Naming style matching correct class names.
+class-naming-style=PascalCase
-# Maximum number of boolean expressions in an if statement (see R0916).
-max-bool-expr=5
+# Regular expression matching correct class names. Overrides class-naming-
+# style. If left empty, class names will be checked with the set naming style.
+#class-rgx=
-# Maximum number of branch for function / method body.
-max-branches=12
+# Naming style matching correct constant names.
+const-naming-style=camelCase
-# Maximum number of locals for function / method body.
-max-locals=15
+# Regular expression matching correct constant names. Overrides const-naming-
+# style. If left empty, constant names will be checked with the set naming
+# style.
+#const-rgx=
-# Maximum number of parents for a class (see R0901).
-max-parents=7
+# Minimum line length for functions/classes that require docstrings, shorter
+# ones are exempt.
+docstring-min-length=-1
-# Maximum number of public methods for a class (see R0904).
-max-public-methods=20
+# Naming style matching correct function names.
+function-naming-style=camelCase
-# Maximum number of return / yield for function / method body.
-max-returns=6
+# Regular expression matching correct function names. Overrides function-
+# naming-style. If left empty, function names will be checked with the set
+# naming style.
+#function-rgx=
-# Maximum number of statements in function / method body.
-max-statements=50
+# Good variable names which should always be accepted, separated by a comma.
+good-names=i,
+ j,
+ k,
+ ex,
+ Run,
+ _
-# Minimum number of public methods for a class (see R0903).
-min-public-methods=2
+# Good variable names regexes, separated by a comma. If names match any regex,
+# they will always be accepted
+good-names-rgxs=
+# Include a hint for the correct naming format with invalid-name.
+include-naming-hint=no
-[IMPORTS]
+# Naming style matching correct inline iteration names.
+inlinevar-naming-style=any
-# List of modules that can be imported at any level, not just the top level
-# one.
-allow-any-import-level=
+# Regular expression matching correct inline iteration names. Overrides
+# inlinevar-naming-style. If left empty, inline iteration names will be checked
+# with the set naming style.
+#inlinevar-rgx=
-# Allow wildcard imports from modules that define __all__.
-allow-wildcard-with-all=no
+# Naming style matching correct method names.
+method-naming-style=snake_case
-# Analyse import fallback blocks. This can be used to support both Python 2 and
-# 3 compatible code, which means that the block might have code that exists
-# only in one or another interpreter, leading to false positives when analysed.
-analyse-fallback-blocks=no
+# Regular expression matching correct method names. Overrides method-naming-
+# style. If left empty, method names will be checked with the set naming style.
+#method-rgx=
-# Deprecated modules which should not be used, separated by a comma.
-deprecated-modules=
+# Naming style matching correct module names.
+module-naming-style=snake_case
-# Output a graph (.gv or any supported image format) of external dependencies
-# to the given file (report RP0402 must not be disabled).
-ext-import-graph=
+# Regular expression matching correct module names. Overrides module-naming-
+# style. If left empty, module names will be checked with the set naming style.
+#module-rgx=
-# Output a graph (.gv or any supported image format) of all (i.e. internal and
-# external) dependencies to the given file (report RP0402 must not be
-# disabled).
-import-graph=
+# Colon-delimited sets of names that determine each other's naming style when
+# the name regexes allow several styles.
+name-group=
-# Output a graph (.gv or any supported image format) of internal dependencies
-# to the given file (report RP0402 must not be disabled).
-int-import-graph=
+# Regular expression which should only match function or class names that do
+# not require a docstring.
+no-docstring-rgx=^_
-# Force import order to recognize a module as part of the standard
-# compatibility libraries.
-known-standard-library=
+# List of decorators that produce properties, such as abc.abstractproperty. Add
+# to this list to register other decorators that produce valid properties.
+# These decorators are taken in consideration only for invalid-name.
+property-classes=abc.abstractproperty
-# Force import order to recognize a module as part of a third party library.
-known-third-party=enchant
+# Regular expression matching correct type variable names. If left empty, type
+# variable names will be checked with the set naming style.
+#typevar-rgx=
-# Couples of modules and preferred modules, separated by a comma.
-preferred-modules=
+# Naming style matching correct variable names.
+variable-naming-style=camelCase
+# Regular expression matching correct variable names. Overrides variable-
+# naming-style. If left empty, variable names will be checked with the set
+# naming style.
+#variable-rgx=
-[EXCEPTIONS]
-# Exceptions that will emit a warning when being caught. Defaults to
-# "BaseException, Exception".
-overgeneral-exceptions=BaseException,
- Exception
+[CLASSES]
+
+# Warn about protected attribute access inside special methods
+check-protected-access-in-special-methods=no
+
+# List of method names used to declare (i.e. assign) instance attributes.
+defining-attr-methods=__init__,
+ __new__,
+ setUp,
+ __post_init__
+
+# List of member names, which should be excluded from the protected access
+# warning.
+exclude-protected=_asdict,
+ _fields,
+ _replace,
+ _source,
+ _make
+
+# List of valid names for the first argument in a class method.
+valid-classmethod-first-arg=cls
+
+# List of valid names for the first argument in a metaclass class method.
+valid-metaclass-classmethod-first-arg=cls
+
+
+[REFACTORING]
+
+# Maximum number of nested blocks for function / method body
+max-nested-blocks=5
+
+# Complete name of functions that never returns. When checking for
+# inconsistent-return-statements if a never returning function is called then
+# it will be considered as an explicit return statement and no message will be
+# printed.
+never-returning-functions=sys.exit,argparse.parse_error
diff --git a/.reuse/dep5 b/.reuse/dep5
index 7431b193..c88428c6 100644
--- a/.reuse/dep5
+++ b/.reuse/dep5
@@ -9,7 +9,7 @@ Copyright: Copyright Contributors to the libical project
License: LGPL-2.1-only OR MPL-2.0
#tool configuration files
-Files: .clang-tidy .cmake-format.py .codespellrc .dir-locals.el .gitignore .krazy .mdlrc .mdlrc.rb .pre-commit-config.yaml .pylintrc .travis.yml appveyor.yml
+Files: .clang-tidy .cmake-format.py .codespellrc .dir-locals.el .gitignore .krazy .mdlrc .mdlrc.rb .pre-commit-config.yaml .pylintrc .pep8 .travis.yml appveyor.yml
Copyright: Copyright Contributors to the libical project
License: BSD-3-Clause
diff --git a/src/test/libical-glib/array.py b/src/test/libical-glib/array.py
index da3b26b2..b90257c6 100644
--- a/src/test/libical-glib/array.py
+++ b/src/test/libical-glib/array.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./array.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./array.py
###############################################################################
#
@@ -7,68 +7,66 @@
#
# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-#
-#
-#
###############################################################################
+''' Test Python bindings for libical arrays '''
+
+from gi.repository import ICalGLib
import gi
gi.require_version('ICalGLib', '3.0')
-from gi.repository import ICalGLib
-
-array = ICalGLib.Timezone.array_new();
+array = ICalGLib.Timezone.array_new()
-#TEST APPEND
-zone0 = ICalGLib.Timezone.get_builtin_timezone("Pacific/Midway");
-zone1 = ICalGLib.Timezone.get_builtin_timezone("America/Vancouver");
-zone2 = ICalGLib.Timezone.get_builtin_timezone("Atlantic/Bermuda");
-zone3 = ICalGLib.Timezone.get_builtin_timezone("Africa/Casablanca");
-zone4 = ICalGLib.Timezone.get_builtin_timezone("Asia/Irkutsk");
+# TEST APPEND
+zone0 = ICalGLib.Timezone.get_builtin_timezone("Pacific/Midway")
+zone1 = ICalGLib.Timezone.get_builtin_timezone("America/Vancouver")
+zone2 = ICalGLib.Timezone.get_builtin_timezone("Atlantic/Bermuda")
+zone3 = ICalGLib.Timezone.get_builtin_timezone("Africa/Casablanca")
+zone4 = ICalGLib.Timezone.get_builtin_timezone("Asia/Irkutsk")
-ICalGLib.Timezone.array_append_from_vtimezone(array, zone0.get_component());
-ICalGLib.Timezone.array_append_from_vtimezone(array, zone1.get_component());
-ICalGLib.Timezone.array_append_from_vtimezone(array, zone2.get_component());
-ICalGLib.Timezone.array_append_from_vtimezone(array, zone3.get_component());
-ICalGLib.Timezone.array_append_from_vtimezone(array, zone4.get_component());
+ICalGLib.Timezone.array_append_from_vtimezone(array, zone0.get_component())
+ICalGLib.Timezone.array_append_from_vtimezone(array, zone1.get_component())
+ICalGLib.Timezone.array_append_from_vtimezone(array, zone2.get_component())
+ICalGLib.Timezone.array_append_from_vtimezone(array, zone3.get_component())
+ICalGLib.Timezone.array_append_from_vtimezone(array, zone4.get_component())
assert array.size() == 5
-z0 = ICalGLib.Timezone.array_element_at(array, 0);
-assert(z0.get_location() == zone0.get_location());
-z1 = ICalGLib.Timezone.array_element_at(array, 1);
-assert(z1.get_location() == zone1.get_location());
-z2 = ICalGLib.Timezone.array_element_at(array, 2);
-assert(z2.get_location() == zone2.get_location());
-z3 = ICalGLib.Timezone.array_element_at(array, 3);
-assert(z3.get_location() == zone3.get_location());
-z4 = ICalGLib.Timezone.array_element_at(array, 4);
-assert(z4.get_location() == zone4.get_location());
+z0 = ICalGLib.Timezone.array_element_at(array, 0)
+assert z0.get_location() == zone0.get_location()
+z1 = ICalGLib.Timezone.array_element_at(array, 1)
+assert z1.get_location() == zone1.get_location()
+z2 = ICalGLib.Timezone.array_element_at(array, 2)
+assert z2.get_location() == zone2.get_location()
+z3 = ICalGLib.Timezone.array_element_at(array, 3)
+assert z3.get_location() == zone3.get_location()
+z4 = ICalGLib.Timezone.array_element_at(array, 4)
+assert z4.get_location() == zone4.get_location()
-array2 = array.copy();
+array2 = array.copy()
assert array2.size() == 5
-z0 = ICalGLib.Timezone.array_element_at(array2, 0);
-assert(z0.get_location() == zone0.get_location());
-z1 = ICalGLib.Timezone.array_element_at(array2, 1);
-assert(z1.get_location() == zone1.get_location());
-z2 = ICalGLib.Timezone.array_element_at(array2, 2);
-assert(z2.get_location() == zone2.get_location());
-z3 = ICalGLib.Timezone.array_element_at(array2, 3);
-assert(z3.get_location() == zone3.get_location());
-z4 = ICalGLib.Timezone.array_element_at(array2, 4);
-assert(z4.get_location() == zone4.get_location());
+z0 = ICalGLib.Timezone.array_element_at(array2, 0)
+assert z0.get_location() == zone0.get_location()
+z1 = ICalGLib.Timezone.array_element_at(array2, 1)
+assert z1.get_location() == zone1.get_location()
+z2 = ICalGLib.Timezone.array_element_at(array2, 2)
+assert z2.get_location() == zone2.get_location()
+z3 = ICalGLib.Timezone.array_element_at(array2, 3)
+assert z3.get_location() == zone3.get_location()
+z4 = ICalGLib.Timezone.array_element_at(array2, 4)
+assert z4.get_location() == zone4.get_location()
-array.remove_element_at(2);
+array.remove_element_at(2)
assert array.size() == 4
-z0 = ICalGLib.Timezone.array_element_at(array, 0);
-assert(z0.get_location() == zone0.get_location());
-z1 = ICalGLib.Timezone.array_element_at(array, 1);
-assert(z1.get_location() == zone1.get_location());
-z3 = ICalGLib.Timezone.array_element_at(array, 2);
-assert(z3.get_location() == zone3.get_location());
-z4 = ICalGLib.Timezone.array_element_at(array, 3);
-assert(z4.get_location() == zone4.get_location());
+z0 = ICalGLib.Timezone.array_element_at(array, 0)
+assert z0.get_location() == zone0.get_location()
+z1 = ICalGLib.Timezone.array_element_at(array, 1)
+assert z1.get_location() == zone1.get_location()
+z3 = ICalGLib.Timezone.array_element_at(array, 2)
+assert z3.get_location() == zone3.get_location()
+z4 = ICalGLib.Timezone.array_element_at(array, 3)
+assert z4.get_location() == zone4.get_location()
diff --git a/src/test/libical-glib/attach.py b/src/test/libical-glib/attach.py
index 7bcb5583..97b9621d 100644
--- a/src/test/libical-glib/attach.py
+++ b/src/test/libical-glib/attach.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./attach.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./attach.py
###############################################################################
#
@@ -7,27 +7,26 @@
#
# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-#
-#
-#
###############################################################################
+''' Test Python bindings for libical attachments '''
+
+from gi.repository import ICalGLib
import gi
gi.require_version('ICalGLib', '3.0')
-from gi.repository import ICalGLib
-dummy_url = "https://people.gnome.org/~engagement/logos/GnomeLogoVertical.svg";
-dummy_data = "It's a super large attachment";
+dummyUrl = "https://people.gnome.org/~engagement/logos/GnomeLogoVertical.svg"
+dummyData = "It's a super large attachment"
-attach_url = ICalGLib.Attach.new_from_url(dummy_url);
-assert(attach_url.get_is_url() == 1);
+attachUrl = ICalGLib.Attach.new_from_url(dummyUrl)
+assert attachUrl.get_is_url() == 1
-retrieved_url = attach_url.get_url();
-assert(retrieved_url == dummy_url);
+retrievedUrl = attachUrl.get_url()
+assert retrievedUrl == dummyUrl
-attach_data = ICalGLib.Attach.new_from_data(dummy_data, None, None);
-assert(attach_data.get_is_url() == 0);
-retrieved_data = attach_data.get_data();
-assert(retrieved_data == dummy_data);
+attach_data = ICalGLib.Attach.new_from_data(dummyData, None, None)
+assert attach_data.get_is_url() == 0
+retrieved_data = attach_data.get_data()
+assert retrieved_data == dummyData
diff --git a/src/test/libical-glib/component.py b/src/test/libical-glib/component.py
index 13d6b104..ce2568aa 100644
--- a/src/test/libical-glib/component.py
+++ b/src/test/libical-glib/component.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./component.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./component.py
###############################################################################
#
@@ -7,21 +7,19 @@
#
# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-#
-#
-#
###############################################################################
-import gi
+# pylint: disable=missing-function-docstring,missing-class-docstring
-gi.require_version('ICalGLib', '3.0')
+''' Test Python bindings for libical components '''
from gi.repository import ICalGLib
+import gi
+
+gi.require_version('ICalGLib', '3.0')
-import os
-import sys
-event_str1 = \
+eventStr1 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:test1\n" \
@@ -36,7 +34,7 @@ event_str1 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VEVENT\n"
-event_str2 = \
+eventStr2 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:test2\n" \
@@ -51,7 +49,7 @@ event_str2 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VEVENT\n"
-event_str3 = \
+eventStr3 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:test3\n" \
@@ -66,7 +64,7 @@ event_str3 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VEVENT\n"
-event_str4 = \
+eventStr4 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:test4\n" \
@@ -81,7 +79,7 @@ event_str4 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VCALENDAR\n"
-event_str5 = \
+eventStr5 = \
"BEGIN:VCALENDAR\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:test5\n" \
@@ -96,7 +94,7 @@ event_str5 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VCALENDAR\n"
-recurring_str = \
+recurringStr = \
"BEGIN:VEVENT\r\n" \
"UID:recurring\r\n" \
"DTSTAMP:20180403T101443Z\r\n" \
@@ -110,211 +108,221 @@ recurring_str = \
#############################################################
-class TestCounter:
+
+class TestCounter: # pylint: disable=too-few-public-methods
counter = 0
+
def inc(self):
self.counter = self.counter + 1
+
def foreachTZIDCb(param, user_data):
+ del param
user_data.inc()
+
def foreachRecurrenceCb(comp, span, user_data):
+ del comp
+ del span
user_data.inc()
#############################################################
-def main():
- #Test as_ical_string
- comp = ICalGLib.Component.new_from_string(event_str1);
- string = comp.as_ical_string();
-
- #Test new_clone
- clone = comp.clone();
- string1 = clone.as_ical_string();
- assert(string == string1);
- assert(comp.is_valid() == 1);
- assert(comp.isa_component() == 1);
- assert(comp.isa() == ICalGLib.ComponentKind.VEVENT_COMPONENT);
-
- #Test check_restrictions
- assert(comp.check_restrictions() == 0);
-
- #Test count_errors
- assert(comp.count_errors() == 0);
-
- #Test kind_is_valid
- assert(ICalGLib.Component.kind_is_valid(ICalGLib.ComponentKind.VEVENT_COMPONENT) == True);
-
- #Test kind_to_string
- kind_string = ICalGLib.Component.kind_to_string(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- assert(ICalGLib.Component.kind_from_string(kind_string) == ICalGLib.ComponentKind.VEVENT_COMPONENT);
-
- #Test child component manipulation
- parent = ICalGLib.Component.new_from_string(event_str1);
- comp1 = ICalGLib.Component.new_from_string(event_str2);
- comp2 = ICalGLib.Component.new_from_string(event_str3);
- comp3 = ICalGLib.Component.new_from_string(event_str4);
- comp4 = ICalGLib.Component.new_from_string(event_str5);
-
- parent.add_component(comp1);
- parent.add_component(comp2);
- parent.add_component(comp3);
- parent.add_component(comp4);
-
- assert parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT) == 3;
- assert parent.count_components(ICalGLib.ComponentKind.VCALENDAR_COMPONENT) == 1;
-
- #Traverse with internal API.
- count = parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- child_component = parent.get_first_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
+
+def main(): # pylint: disable=too-many-statements,too-many-locals
+ # Test as_ical_string
+ comp = ICalGLib.Component.new_from_string(eventStr1)
+ string = comp.as_ical_string()
+
+ # Test new_clone
+ clone = comp.clone()
+ string1 = clone.as_ical_string()
+ assert string == string1
+ assert comp.is_valid() == 1
+ assert comp.isa_component() == 1
+ assert comp.isa() == ICalGLib.ComponentKind.VEVENT_COMPONENT
+
+ # Test check_restrictions
+ assert comp.check_restrictions() == 0
+
+ # Test count_errors
+ assert comp.count_errors() == 0
+
+ # Test kind_is_valid
+ assert ICalGLib.Component.kind_is_valid(ICalGLib.ComponentKind.VEVENT_COMPONENT) is True
+
+ # Test kind_to_string
+ kindString = ICalGLib.Component.kind_to_string(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ assert ICalGLib.Component.kind_from_string(kindString) == ICalGLib.ComponentKind.VEVENT_COMPONENT
+
+ # Test child component manipulation
+ parent = ICalGLib.Component.new_from_string(eventStr1)
+ comp1 = ICalGLib.Component.new_from_string(eventStr2)
+ comp2 = ICalGLib.Component.new_from_string(eventStr3)
+ comp3 = ICalGLib.Component.new_from_string(eventStr4)
+ comp4 = ICalGLib.Component.new_from_string(eventStr5)
+
+ parent.add_component(comp1)
+ parent.add_component(comp2)
+ parent.add_component(comp3)
+ parent.add_component(comp4)
+
+ assert parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT) == 3
+ assert parent.count_components(ICalGLib.ComponentKind.VCALENDAR_COMPONENT) == 1
+
+ # Traverse with internal API.
+ count = parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ childComponent = parent.get_first_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
for i in range(0, count):
prefix = "test"
- index = i+2;
- assert(child_component.get_summary() == prefix + str(index));
- if (i != count-1):
- child_component = parent.get_next_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
-
- #Traverse with external API.
- iter = parent.begin_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- child_component = iter.deref();
+ index = i+2
+ assert childComponent.get_summary() == prefix + str(index)
+ if i != count-1:
+ childComponent = parent.get_next_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+
+ # Traverse with external API.
+ iterator = parent.begin_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ childComponent = iterator.deref()
for i in range(0, count):
prefix = "test"
- index = i+2;
- assert(child_component.get_summary() == prefix + str(index));
- if (i != count-1):
- child_component = iter.next();
+ index = i+2
+ assert childComponent.get_summary() == prefix + str(index)
+ if i != count-1:
+ childComponent = iterator.next()
- iter = parent.end_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- child_component = iter.prior();
+ iterator = parent.end_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ childComponent = iterator.prior()
for i in range(0, count):
prefix = "test"
- index = count + 1 - i;
- assert(child_component.get_summary() == prefix + str(index));
- if (i != count - 1):
- child_component = iter.prior();
-
- #Traverse and remove with external API.
- iter = parent.begin_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- child_component = iter.deref();
+ index = count + 1 - i
+ assert childComponent.get_summary() == prefix + str(index)
+ if i != count - 1:
+ childComponent = iterator.prior()
+
+ # Traverse and remove with external API.
+ iterator = parent.begin_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ childComponent = iterator.deref()
for i in range(0, count):
- if (i != count - 1):
- iter.next();
- parent.remove_component(child_component);
- if (i != count - 1):
- child_component = iter.deref();
- assert parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT) == 0;
-
- #Test property mainpulation
- property_string = "SUMMARY:Bastille Day Party";
- string_property = ICalGLib.Property.new_from_string(property_string);
- component = ICalGLib.Component.new(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- component.add_property(string_property);
- assert(component.count_properties(ICalGLib.PropertyKind.SUMMARY_PROPERTY) == 1);
- component.remove_property(string_property);
- assert(component.count_properties(ICalGLib.PropertyKind.SUMMARY_PROPERTY) == 0);
-
- component.add_property(string_property);
- property_string2 = "SUMMARY:event-uid-123";
- string_property2 = ICalGLib.Property.new_from_string(property_string2);
- component.add_property(string_property2);
- component.add_property(ICalGLib.Property.new_from_string("SUMMARY:20140306T090000"));
- assert(component.count_properties(ICalGLib.PropertyKind.SUMMARY_PROPERTY) == 3);
- property1 = component.get_first_property(ICalGLib.PropertyKind.SUMMARY_PROPERTY);
- assert(property1.as_ical_string().split('\n', 1)[0] == "SUMMARY:Bastille Day Party\r");
- property2 = component.get_next_property(ICalGLib.PropertyKind.SUMMARY_PROPERTY);
- assert(property2.as_ical_string().split('\n', 1)[0] == "SUMMARY:event-uid-123\r");
- property3 = component.get_next_property(ICalGLib.PropertyKind.SUMMARY_PROPERTY);
- assert(property3.as_ical_string().split('\n', 1)[0] == "SUMMARY:20140306T090000\r");
-
- #Test getters and setters
- #Test get_dtstart and get_dtend
- comp = ICalGLib.Component.new_from_string(event_str1);
- dtstart = comp.get_dtstart();
- start_string = ICalGLib.Time.as_ical_string(dtstart);
- assert(start_string == "20140306T090000");
- dtend = comp.get_dtend();
- end_string = dtend.as_ical_string();
- assert(end_string == "20140306T093000");
-
- #Test span
- span = comp.get_span();
- assert(span.get_start() == 1394096400);
- assert(span.get_end() == 1394098200);
- assert(span.get_is_busy() == 1);
- utc = ICalGLib.Timezone.get_utc_timezone();
- comp.set_dtstart(ICalGLib.Time.new_from_timet_with_zone(1494096400, 0, utc));
- comp.set_dtend(ICalGLib.Time.new_from_timet_with_zone(1494098200, 0, utc));
- span = comp.get_span();
- assert(span.get_start() == 1494096400);
- assert(span.get_end() == 1494098200);
- assert(span.get_is_busy() == 1);
-
- #Test set_summary/get_summary
- assert(comp.get_summary() == "test1");
- comp.set_summary("newSummary");
- assert(comp.get_summary() == "newSummary");
-
- #Test set_comment/get_comment
- assert(comp.get_comment() == None);
- comp.set_comment("newcomment");
- assert(comp.get_comment() == "newcomment");
-
- #Test set_uid/get_uid
- assert(comp.get_uid() == "event-uid-123");
- comp.set_uid("newuid");
- assert(comp.get_uid() == "newuid");
-
- #Test set_relcalid/get_relcalid
- assert(comp.get_relcalid() == None);
- comp.set_relcalid("newrelcalid");
- assert(comp.get_relcalid() == "newrelcalid");
-
- #Test set_description/get_description
- assert(comp.get_description() == None);
- comp.set_description("newdescription");
- assert(comp.get_description() == "newdescription");
-
- #Test set_location/get_location
- assert(comp.get_location() == "Location");
- comp.set_location("newlocation");
- assert(comp.get_location() == "newlocation");
-
- #Test set_sequence/get_sequence
- assert(comp.get_sequence() == 0);
- comp.set_sequence(5);
- assert(comp.get_sequence() == 5);
-
- #Call comp_foreach_tzid
- comp = ICalGLib.Component.new_from_string(event_str1);
+ if i != count - 1:
+ iterator.next()
+ parent.remove_component(childComponent)
+ if i != count - 1:
+ childComponent = iterator.deref()
+ assert parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT) == 0
+
+ # Test property mainpulation
+ propertyString = "SUMMARY:Bastille Day Party"
+ stringProperty = ICalGLib.Property.new_from_string(propertyString)
+ component = ICalGLib.Component.new(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ component.add_property(stringProperty)
+ assert component.count_properties(ICalGLib.PropertyKind.SUMMARY_PROPERTY) == 1
+ component.remove_property(stringProperty)
+ assert component.count_properties(ICalGLib.PropertyKind.SUMMARY_PROPERTY) == 0
+
+ component.add_property(stringProperty)
+ propertyString2 = "SUMMARY:event-uid-123"
+ stringProperty2 = ICalGLib.Property.new_from_string(propertyString2)
+ component.add_property(stringProperty2)
+ component.add_property(ICalGLib.Property.new_from_string("SUMMARY:20140306T090000"))
+ assert component.count_properties(ICalGLib.PropertyKind.SUMMARY_PROPERTY) == 3
+ property1 = component.get_first_property(ICalGLib.PropertyKind.SUMMARY_PROPERTY)
+ assert property1.as_ical_string().split('\n', 1)[0] == "SUMMARY:Bastille Day Party\r"
+ property2 = component.get_next_property(ICalGLib.PropertyKind.SUMMARY_PROPERTY)
+ assert property2.as_ical_string().split('\n', 1)[0] == "SUMMARY:event-uid-123\r"
+ property3 = component.get_next_property(ICalGLib.PropertyKind.SUMMARY_PROPERTY)
+ assert property3.as_ical_string().split('\n', 1)[0] == "SUMMARY:20140306T090000\r"
+
+ # Test getters and setters
+ # Test get_dtstart and get_dtend
+ comp = ICalGLib.Component.new_from_string(eventStr1)
+ dtstart = comp.get_dtstart()
+ startString = ICalGLib.Time.as_ical_string(dtstart)
+ assert startString == "20140306T090000"
+ dtend = comp.get_dtend()
+ endString = dtend.as_ical_string()
+ assert endString == "20140306T093000"
+
+ # Test span
+ span = comp.get_span()
+ assert span.get_start() == 1394096400
+ assert span.get_end() == 1394098200
+ assert span.get_is_busy() == 1
+ utc = ICalGLib.Timezone.get_utc_timezone()
+ comp.set_dtstart(ICalGLib.Time.new_from_timet_with_zone(1494096400, 0, utc))
+ comp.set_dtend(ICalGLib.Time.new_from_timet_with_zone(1494098200, 0, utc))
+ span = comp.get_span()
+ assert span.get_start() == 1494096400
+ assert span.get_end() == 1494098200
+ assert span.get_is_busy() == 1
+
+ # Test set_summary/get_summary
+ assert comp.get_summary() == "test1"
+ comp.set_summary("newSummary")
+ assert comp.get_summary() == "newSummary"
+
+ # Test set_comment/get_comment
+ assert comp.get_comment() is None
+ comp.set_comment("newcomment")
+ assert comp.get_comment() == "newcomment"
+
+ # Test set_uid/get_uid
+ assert comp.get_uid() == "event-uid-123"
+ comp.set_uid("newuid")
+ assert comp.get_uid() == "newuid"
+
+ # Test set_relcalid/get_relcalid
+ assert comp.get_relcalid() is None
+ comp.set_relcalid("newrelcalid")
+ assert comp.get_relcalid() == "newrelcalid"
+
+ # Test set_description/get_description
+ assert comp.get_description() is None
+ comp.set_description("newdescription")
+ assert comp.get_description() == "newdescription"
+
+ # Test set_location/get_location
+ assert comp.get_location() == "Location"
+ comp.set_location("newlocation")
+ assert comp.get_location() == "newlocation"
+
+ # Test set_sequence/get_sequence
+ assert comp.get_sequence() == 0
+ comp.set_sequence(5)
+ assert comp.get_sequence() == 5
+
+ # Call comp_foreach_tzid
+ comp = ICalGLib.Component.new_from_string(eventStr1)
counter = TestCounter()
- comp.foreach_tzid(foreachTZIDCb, counter);
+ comp.foreach_tzid(foreachTZIDCb, counter)
assert counter.counter == 2
counter = TestCounter()
- comp = ICalGLib.Component.new_from_string(recurring_str)
- comp.foreach_recurrence(ICalGLib.Time.new_from_string("20180321T000000Z"), ICalGLib.Time.new_from_string("20180323T235959Z"), foreachRecurrenceCb, counter)
+ comp = ICalGLib.Component.new_from_string(recurringStr)
+ comp.foreach_recurrence(ICalGLib.Time.new_from_string("20180321T000000Z"),
+ ICalGLib.Time.new_from_string("20180323T235959Z"), foreachRecurrenceCb, counter)
assert counter.counter == 3
- comp = ICalGLib.Component.new_from_string(event_str1);
+ comp = ICalGLib.Component.new_from_string(eventStr1)
prop = comp.get_first_property(ICalGLib.PropertyKind.DTSTART_PROPERTY)
prop.remove_parameter_by_kind(ICalGLib.ParameterKind.TZID_PARAMETER)
- tz = ICalGLib.Timezone.get_builtin_timezone("Europe/Prague")
+ zone = ICalGLib.Timezone.get_builtin_timezone("Europe/Prague")
- ICalGLib.Timezone.set_tzid_prefix(tz.get_tzid().replace("Europe/Prague", ""))
+ ICalGLib.Timezone.set_tzid_prefix(zone.get_tzid().replace("Europe/Prague", ""))
- prop.set_parameter(ICalGLib.Parameter.new_tzid(tz.get_tzid()))
+ prop.set_parameter(ICalGLib.Parameter.new_tzid(zone.get_tzid()))
itt = prop.get_datetime_with_component(comp)
- assert itt.get_timezone() != None
+ assert itt.get_timezone() is not None
assert itt.get_timezone().get_location() == "Europe/Prague"
itt = prop.get_datetime_with_component(None)
- assert itt.get_timezone() != None
+ assert itt.get_timezone() is not None
assert itt.get_timezone().get_location() == "Europe/Prague"
itt = comp.get_dtstart()
- assert itt.get_timezone() != None
+ assert itt.get_timezone() is not None
assert itt.get_timezone().get_location() == "Europe/Prague"
+
if __name__ == "__main__":
main()
diff --git a/src/test/libical-glib/comprehensive.py b/src/test/libical-glib/comprehensive.py
index 4f3fe629..820b3472 100644
--- a/src/test/libical-glib/comprehensive.py
+++ b/src/test/libical-glib/comprehensive.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./comprehensive.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./comprehensive.py
###############################################################################
#
@@ -7,18 +7,17 @@
#
# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-#
-#
-#
###############################################################################
+''' Comprehensive testing for Python libical bindings '''
+
+from gi.repository import ICalGLib
import gi
gi.require_version('ICalGLib', '3.0')
-from gi.repository import ICalGLib
-event_str1 = \
+eventStr1 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:parent\n" \
@@ -33,7 +32,7 @@ event_str1 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VEVENT\n"
-event_str2 = \
+eventStr2 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:childEvent1\n" \
@@ -48,7 +47,7 @@ event_str2 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VEVENT\n"
-event_str3 = \
+eventStr3 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:childEvent2\n" \
@@ -63,7 +62,7 @@ event_str3 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VEVENT\n"
-event_str4 = \
+eventStr4 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:childEvent3\n" \
@@ -78,7 +77,7 @@ event_str4 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VCALENDAR\n"
-event_str5 = \
+eventStr5 = \
"BEGIN:VCALENDAR\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:childCalendar1\n" \
@@ -93,7 +92,7 @@ event_str5 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VCALENDAR\n"
-combined_string = \
+combinedString = \
"BEGIN:VEVENT\r\n" \
"UID:event-uid-123\r\n" \
"SUMMARY;LANGUAGE=en-US:parent\r\n" \
@@ -160,67 +159,69 @@ combined_string = \
"END:VCALENDAR\r\n" \
"END:VEVENT\r\n"
-def main():
- #Test child component manipulation
- parent = ICalGLib.Component.new_from_string(event_str1);
- comp1 = ICalGLib.Component.new_from_string(event_str2);
- comp2 = ICalGLib.Component.new_from_string(event_str3);
- comp3 = ICalGLib.Component.new_from_string(event_str4);
- comp4 = ICalGLib.Component.new_from_string(event_str5);
- parent.add_component(comp1);
- parent.add_component(comp2);
- parent.add_component(comp3);
- parent.add_component(comp4);
+def main(): # pylint: disable=too-many-locals
+ ''' Test child component manipulation '''
+ parent = ICalGLib.Component.new_from_string(eventStr1)
+ comp1 = ICalGLib.Component.new_from_string(eventStr2)
+ comp2 = ICalGLib.Component.new_from_string(eventStr3)
+ comp3 = ICalGLib.Component.new_from_string(eventStr4)
+ comp4 = ICalGLib.Component.new_from_string(eventStr5)
- assert parent.as_ical_string() == combined_string;
+ parent.add_component(comp1)
+ parent.add_component(comp2)
+ parent.add_component(comp3)
+ parent.add_component(comp4)
- count = parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- child_component = parent.get_first_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
+ assert parent.as_ical_string() == combinedString
+
+ count = parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ childComponent = parent.get_first_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
for i in range(0, count):
- if (child_component.get_summary() == "childEvent2"):
- child_component.set_summary("childEventTwo");
+ if childComponent.get_summary() == "childEvent2":
+ childComponent.set_summary("childEventTwo")
- start = ICalGLib.Time.new_from_string("20141115T211923");
- end = ICalGLib.Time.new_from_string("20141115T221923");
- child_component.set_dtstart(start);
- child_component.set_dtend(end);
+ start = ICalGLib.Time.new_from_string("20141115T211923")
+ end = ICalGLib.Time.new_from_string("20141115T221923")
+ childComponent.set_dtstart(start)
+ childComponent.set_dtend(end)
- child_component.set_dtstamp(start);
- child_component.set_location("East Lansing, MI, US");
+ childComponent.set_dtstamp(start)
+ childComponent.set_location("East Lansing, MI, US")
- child_component.set_relcalid("relcalid for childEventTwo");
- recur_string = "RRULE:FREQ=DAILY;INTERVAL=10;COUNT=5";
- property = ICalGLib.Property.new_from_string(recur_string);
- child_component.add_property(property);
- if (i != count-1):
- child_component = parent.get_next_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
+ childComponent.set_relcalid("relcalid for childEventTwo")
+ recurString = "RRULE:FREQ=DAILY;INTERVAL=10;COUNT=5"
+ recurProperty = ICalGLib.Property.new_from_string(recurString)
+ childComponent.add_property(recurProperty)
+ if i != count-1:
+ childComponent = parent.get_next_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
- modifiedCombinedString = parent.as_ical_string();
- newParent = ICalGLib.Component.new_from_string(modifiedCombinedString);
+ modifiedCombinedString = parent.as_ical_string()
+ ICalGLib.Component.new_from_string(modifiedCombinedString)
- count = parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- child_component = parent.get_first_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
+ count = parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ childComponent = parent.get_first_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
for i in range(0, count):
- if (child_component.get_summary() == "childEventTwo"):
- child_component.set_summary("childEventTwo");
-
- dtstart = child_component.get_dtstart();
- start_string = ICalGLib.Time.as_ical_string(dtstart);
- assert(start_string == "20141115T211923");
- dtend = child_component.get_dtend();
- end_string = ICalGLib.Time.as_ical_string(dtend);
- assert(end_string == "20141115T221923");
-
- timestamp = child_component.get_dtstamp();
- assert(ICalGLib.Time.as_ical_string(timestamp) == "20141115T211923");
- assert(child_component.get_location() == "East Lansing, MI, US");
- assert(child_component.get_relcalid() == "relcalid for childEventTwo");
-
- recurProperty = child_component.get_first_property(ICalGLib.PropertyKind.RRULE_PROPERTY);
- assert recurProperty.as_ical_string() == "RRULE:FREQ=DAILY;INTERVAL=10;COUNT=5\r\n";
- if (i != count-1):
- child_component = parent.get_next_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
+ if childComponent.get_summary() == "childEventTwo":
+ childComponent.set_summary("childEventTwo")
+
+ dtstart = childComponent.get_dtstart()
+ startString = ICalGLib.Time.as_ical_string(dtstart)
+ assert startString == "20141115T211923"
+ dtend = childComponent.get_dtend()
+ endString = ICalGLib.Time.as_ical_string(dtend)
+ assert endString == "20141115T221923"
+
+ timestamp = childComponent.get_dtstamp()
+ assert ICalGLib.Time.as_ical_string(timestamp) == "20141115T211923"
+ assert childComponent.get_location() == "East Lansing, MI, US"
+ assert childComponent.get_relcalid() == "relcalid for childEventTwo"
+
+ recurProperty = childComponent.get_first_property(ICalGLib.PropertyKind.RRULE_PROPERTY)
+ assert recurProperty.as_ical_string() == "RRULE:FREQ=DAILY;INTERVAL=10;COUNT=5\r\n"
+ if i != count-1:
+ childComponent = parent.get_next_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+
if __name__ == "__main__":
main()
diff --git a/src/test/libical-glib/duration.py b/src/test/libical-glib/duration.py
index b6a1ac78..bd353417 100644
--- a/src/test/libical-glib/duration.py
+++ b/src/test/libical-glib/duration.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./duration-type.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./duration-type.py
###############################################################################
#
@@ -7,30 +7,29 @@
#
# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-#
-#
-#
###############################################################################
+''' Test Python bindings for libical duration '''
+
+from gi.repository import ICalGLib
import gi
gi.require_version('ICalGLib', '3.0')
-from gi.repository import ICalGLib
-length = 1000000000;
-bad_string = "This is a bad string";
-
-duration = ICalGLib.Duration.new_from_int(length);
-assert(duration.as_int() == length);
-length_in_string = duration.as_ical_string();
-duration1 = ICalGLib.Duration.new_from_string(length_in_string);
-assert(duration1.as_ical_string() == length_in_string);
-assert(length == duration1.as_int());
-
-duration = ICalGLib.Duration.new_from_string(bad_string);
-duration_bad = ICalGLib.Duration.new_bad_duration();
-assert(duration.as_ical_string() == duration_bad.as_ical_string());
-assert(duration.is_bad_duration() == 1);
-duration_null = ICalGLib.Duration.new_null_duration();
-assert(duration_null.is_null_duration() == 1);
+length = 1000000000
+badString = "This is a bad string"
+
+duration = ICalGLib.Duration.new_from_int(length)
+assert duration.as_int() == length
+length_in_string = duration.as_ical_string()
+duration1 = ICalGLib.Duration.new_from_string(length_in_string)
+assert duration1.as_ical_string() == length_in_string
+assert length == duration1.as_int()
+
+duration = ICalGLib.Duration.new_from_string(badString)
+durationBad = ICalGLib.Duration.new_bad_duration()
+assert duration.as_ical_string() == durationBad.as_ical_string()
+assert duration.is_bad_duration() == 1
+duration_null = ICalGLib.Duration.new_null_duration()
+assert duration_null.is_null_duration() == 1
diff --git a/src/test/libical-glib/error.py b/src/test/libical-glib/error.py
index e64de32a..ab3b8b48 100644
--- a/src/test/libical-glib/error.py
+++ b/src/test/libical-glib/error.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./error.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./error.py
###############################################################################
#
@@ -7,32 +7,31 @@
#
# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-#
-#
-#
###############################################################################
+''' Test Python bindings for libical error handling '''
+
+from gi.repository import ICalGLib
import gi
gi.require_version('ICalGLib', '3.0')
-from gi.repository import ICalGLib
-message = "This is a stinky error!";
+message = "This is a stinky error!"
-string_rep = ICalGLib.error_strerror(ICalGLib.ErrorEnum.NEWFAILED_ERROR);
-assert(string_rep == "NEWFAILED: Failed to create a new object via a *_new() routine")
-string_perror = ICalGLib.error_perror();
-assert(string_perror == "NO: No error");
+string_rep = ICalGLib.error_strerror(ICalGLib.ErrorEnum.NEWFAILED_ERROR)
+assert string_rep == "NEWFAILED: Failed to create a new object via a *_new() routine"
+string_perror = ICalGLib.error_perror()
+assert string_perror == "NO: No error"
-ICalGLib.error_set_error_state(ICalGLib.ErrorEnum.NEWFAILED_ERROR, ICalGLib.ErrorState.FATAL);
-state = ICalGLib.error_get_error_state(ICalGLib.ErrorEnum.NEWFAILED_ERROR);
-assert(state == ICalGLib.ErrorState.FATAL);
+ICalGLib.error_set_error_state(ICalGLib.ErrorEnum.NEWFAILED_ERROR, ICalGLib.ErrorState.FATAL)
+state = ICalGLib.error_get_error_state(ICalGLib.ErrorEnum.NEWFAILED_ERROR)
+assert state == ICalGLib.ErrorState.FATAL
-ICalGLib.error_stop_here();
-enumeration = ICalGLib.errno_return();
-string_rep = ICalGLib.error_strerror(enumeration);
-assert(string_rep == "NO: No error");
+ICalGLib.error_stop_here()
+enumeration = ICalGLib.errno_return()
+string_rep = ICalGLib.error_strerror(enumeration)
+assert string_rep == "NO: No error"
-state = ICalGLib.error_supress(message);
-ICalGLib.error_restore(message, state);
+state = ICalGLib.error_supress(message)
+ICalGLib.error_restore(message, state)
diff --git a/src/test/libical-glib/misc.py b/src/test/libical-glib/misc.py
index 2cb59d44..c417982f 100644
--- a/src/test/libical-glib/misc.py
+++ b/src/test/libical-glib/misc.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./misc.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./misc.py
###############################################################################
#
@@ -7,16 +7,15 @@
#
# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-#
-#
-#
###############################################################################
+''' Test Python bindings for libical miscellaneous types '''
+
+from gi.repository import ICalGLib
import gi
gi.require_version('ICalGLib', '3.0')
-from gi.repository import ICalGLib
geo = ICalGLib.Geo.new(10.0, 20.0)
assert geo.get_lat() == 10.0
@@ -25,21 +24,21 @@ geo_clone = geo.clone()
assert geo.get_lat() == geo_clone.get_lat()
assert geo.get_lon() == geo_clone.get_lon()
geo_clone.set_lat(30.0)
-geo_clone.set_lon(40.0);
+geo_clone.set_lon(40.0)
assert geo_clone.get_lat() == 30.0
assert geo_clone.get_lon() == 40.0
assert geo.get_lat() != geo_clone.get_lat()
assert geo.get_lon() != geo_clone.get_lon()
-start = ICalGLib.Time.new_from_string("20190130T111213Z");
+start = ICalGLib.Time.new_from_string("20190130T111213Z")
end = ICalGLib.Time.new_from_string("20190203T100908Z")
-span = ICalGLib.TimeSpan.new(start, end, 0);
+span = ICalGLib.TimeSpan.new(start, end, 0)
assert span.get_start() == start.as_timet()
assert span.get_end() == end.as_timet()
assert span.get_is_busy() == 0
-start = ICalGLib.Time.new_from_string("20190330T131415Z");
+start = ICalGLib.Time.new_from_string("20190330T131415Z")
end = ICalGLib.Time.new_from_string("20190403T070605Z")
-span = ICalGLib.TimeSpan.new(start, end, 1);
+span = ICalGLib.TimeSpan.new(start, end, 1)
assert span.get_start() == start.as_timet()
assert span.get_end() == end.as_timet()
assert span.get_is_busy() == 1
diff --git a/src/test/libical-glib/parameter.py b/src/test/libical-glib/parameter.py
index 33cea40a..6c2c6b36 100644
--- a/src/test/libical-glib/parameter.py
+++ b/src/test/libical-glib/parameter.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./parameter.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./parameter.py
###############################################################################
#
@@ -7,60 +7,59 @@
#
# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-#
-#
-#
###############################################################################
+''' Test Python bindings for Libical parameter '''
+
+from gi.repository import ICalGLib
import gi
gi.require_version('ICalGLib', '3.0')
-from gi.repository import ICalGLib
# Test interaction with gchar
-altrep = "This is an altrep";
-parameter = ICalGLib.Parameter.new_altrep(altrep);
-retrieved_altrep = parameter.get_altrep();
-assert(retrieved_altrep == altrep);
-another_altrep = "This is an another altrep";
-parameter.set_altrep(another_altrep);
-retrieved_altrep = parameter.get_altrep();
-assert(retrieved_altrep == another_altrep);
+altrep = "This is an altrep"
+parameter = ICalGLib.Parameter.new_altrep(altrep)
+retrievedAltrep = parameter.get_altrep()
+assert retrievedAltrep == altrep
+anotherAltrep = "This is an another altrep"
+parameter.set_altrep(anotherAltrep)
+retrievedAltrep = parameter.get_altrep()
+assert retrievedAltrep == anotherAltrep
# Test interaction with enum
-action = ICalGLib.ParameterAction.X;
-parameter = ICalGLib.Parameter.new_actionparam(action);
-retrieved_action = parameter.get_actionparam();
-assert(retrieved_action == action);
-action = ICalGLib.ParameterAction.ASK;
-parameter.set_actionparam(action);
-retrieved_action = parameter.get_actionparam();
-assert(retrieved_action == action);
+action = ICalGLib.ParameterAction.X
+parameter = ICalGLib.Parameter.new_actionparam(action)
+retrievedAction = parameter.get_actionparam()
+assert retrievedAction == action
+action = ICalGLib.ParameterAction.ASK
+parameter.set_actionparam(action)
+retrievedAction = parameter.get_actionparam()
+assert retrievedAction == action
# Test general utilities
-kind = ICalGLib.ParameterKind.ACTIONPARAM_PARAMETER;
-parameter = ICalGLib.Parameter.new(kind);
-assert(parameter.isa() == kind);
-assert(parameter.isa_parameter() == 1);
-string = parameter.as_ical_string();
-assert(string == None);
-clone = parameter.clone();
-assert(clone.isa() == kind);
-assert(clone.isa_parameter() == 1);
-string = clone.as_ical_string();
-assert(string == None);
+kind = ICalGLib.ParameterKind.ACTIONPARAM_PARAMETER
+parameter = ICalGLib.Parameter.new(kind)
+assert parameter.isa() == kind
+assert parameter.isa_parameter() == 1
+string = parameter.as_ical_string()
+assert string is None
+clone = parameter.clone()
+assert clone.isa() == kind
+assert clone.isa_parameter() == 1
+string = clone.as_ical_string()
+assert string is None
-string = ICalGLib.Parameter.kind_to_string(kind);
-assert(string == "ACTIONPARAM");
-assert(ICalGLib.Parameter.kind_from_string(string) == kind);
+string = ICalGLib.Parameter.kind_to_string(kind)
+assert string == "ACTIONPARAM"
+assert ICalGLib.Parameter.kind_from_string(string) == kind
-value = "This is a value";
-typevalue = string + "=" + value;
-parameter = ICalGLib.Parameter.new_from_string(typevalue);
-assert(parameter.as_ical_string() == typevalue);
-assert(parameter.isa() == kind);
-assert(parameter.isa_parameter() == 1);
+value = "This is a value"
+typevalue = string + "=" + value
+parameter = ICalGLib.Parameter.new_from_string(typevalue)
+assert parameter.as_ical_string() == typevalue
+assert parameter.isa() == kind
+assert parameter.isa_parameter() == 1
-another_parameter = ICalGLib.Parameter.new_from_value_string(kind, value);
-assert(another_parameter.as_ical_string() == typevalue);
+anotherParameter = ICalGLib.Parameter.new_from_value_string(kind, value)
+assert anotherParameter.as_ical_string() == typevalue
diff --git a/src/test/libical-glib/period.py b/src/test/libical-glib/period.py
index 1791a34d..166b2a86 100644
--- a/src/test/libical-glib/period.py
+++ b/src/test/libical-glib/period.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./period-type.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./period-type.py
###############################################################################
#
@@ -7,69 +7,68 @@
#
# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-#
-#
-#
###############################################################################
+''' Test Python bindings for libical period '''
+
+from gi.repository import ICalGLib
import gi
gi.require_version('ICalGLib', '3.0')
-from gi.repository import ICalGLib
-string = "19970101T183248Z/19970102T071625Z";
-
-period = ICalGLib.Period.new_from_string(string);
-retrieved_string = period.as_ical_string();
-assert(retrieved_string == string);
-
-null_period = ICalGLib.Period.new_null_period();
-assert(null_period.is_null_period() == 1);
-assert(period.is_null_period() == 0);
-
-assert(null_period.is_valid_period() == 1);
-assert(period.is_valid_period() == 1);
-
-start = period.get_start();
-assert(start.get_year() == 1997);
-assert(start.get_month() == 1);
-assert(start.get_day() == 1);
-assert(start.get_hour() == 18);
-assert(start.get_minute() == 32);
-assert(start.get_second() == 48);
-
-end = period.get_end();
-assert(end.get_year() == 1997);
-assert(end.get_month() == 1);
-assert(end.get_day() == 2);
-assert(end.get_hour() == 7);
-assert(end.get_minute() == 16);
-assert(end.get_second() == 25);
-
-duration = period.get_duration();
-assert(duration.as_int() == 0);
-
-string = "19970101T182346Z/PT5H30M";
-period = ICalGLib.Period.new_from_string(string);
-retrieved_string = period.as_ical_string();
-assert(retrieved_string == string);
-
-start = period.get_start();
-assert(start.get_year() == 1997);
-assert(start.get_month() == 1);
-assert(start.get_day() == 1);
-assert(start.get_hour() == 18);
-assert(start.get_minute() == 23);
-assert(start.get_second() == 46);
-
-end = period.get_end();
-assert(end.get_year() == 0);
-assert(end.get_month() == 0);
-assert(end.get_day() == 0);
-assert(end.get_hour() == 0);
-assert(end.get_minute() == 0);
-assert(end.get_second() == 0);
-
-duration = period.get_duration();
-assert(duration.as_ical_string() == "PT5H30M");
+string = "19970101T183248Z/19970102T071625Z"
+
+period = ICalGLib.Period.new_from_string(string)
+retrievedString = period.as_ical_string()
+assert retrievedString == string
+
+nullPeriod = ICalGLib.Period.new_null_period()
+assert nullPeriod.is_null_period() == 1
+assert period.is_null_period() == 0
+
+assert nullPeriod.is_valid_period() == 1
+assert period.is_valid_period() == 1
+
+start = period.get_start()
+assert start.get_year() == 1997
+assert start.get_month() == 1
+assert start.get_day() == 1
+assert start.get_hour() == 18
+assert start.get_minute() == 32
+assert start.get_second() == 48
+
+end = period.get_end()
+assert end.get_year() == 1997
+assert end.get_month() == 1
+assert end.get_day() == 2
+assert end.get_hour() == 7
+assert end.get_minute() == 16
+assert end.get_second() == 25
+
+duration = period.get_duration()
+assert duration.as_int() == 0
+
+string = "19970101T182346Z/PT5H30M"
+period = ICalGLib.Period.new_from_string(string)
+retrieved_string = period.as_ical_string()
+assert retrieved_string == string
+
+start = period.get_start()
+assert start.get_year() == 1997
+assert start.get_month() == 1
+assert start.get_day() == 1
+assert start.get_hour() == 18
+assert start.get_minute() == 23
+assert start.get_second() == 46
+
+end = period.get_end()
+assert end.get_year() == 0
+assert end.get_month() == 0
+assert end.get_day() == 0
+assert end.get_hour() == 0
+assert end.get_minute() == 0
+assert end.get_second() == 0
+
+duration = period.get_duration()
+assert duration.as_ical_string() == "PT5H30M"
diff --git a/src/test/libical-glib/property.py b/src/test/libical-glib/property.py
index ee78467e..751d6053 100644
--- a/src/test/libical-glib/property.py
+++ b/src/test/libical-glib/property.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./property.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./property.py
###############################################################################
#
@@ -7,92 +7,91 @@
#
# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-#
-#
-#
###############################################################################
+''' Test Python bindings for libical properties '''
+
+from gi.repository import ICalGLib
import gi
gi.require_version('ICalGLib', '3.0')
-from gi.repository import ICalGLib
-action_property = ICalGLib.Property.new(ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY);
-action_property_clone = action_property.clone();
-assert(action_property_clone.as_ical_string() == action_property.as_ical_string());
-
-property_string = "SUMMARY:Bastille Day Party";
-string_property = ICalGLib.Property.new_from_string(property_string);
-string_property_clone = string_property.clone();
-assert(string_property.as_ical_string() == string_property_clone.as_ical_string());
-assert(string_property.isa() == ICalGLib.PropertyKind.SUMMARY_PROPERTY);
-assert(string_property.isa_property() == 1);
-assert(string_property.get_property_name() == "SUMMARY");
-
-altrep1 = "This is an altrep 1";
-parameter1 = ICalGLib.Parameter.new_altrep(altrep1);
-altrep2 = "This is an altrep 2";
-parameter2 = ICalGLib.Parameter.new_altrep(altrep2);
-string_property.add_parameter(parameter1);
-string_property.add_parameter(parameter2);
-string_property.set_parameter_from_string("ACTIONPARAM", "This is a action param");
-
-assert(string_property.count_parameters() == 3);
-retrieved_parameter1 = string_property.get_first_parameter(ICalGLib.ParameterKind.ALTREP_PARAMETER);
-assert(retrieved_parameter1.as_ical_string() == parameter1.as_ical_string());
-retrieved_parameter2 = string_property.get_next_parameter(ICalGLib.ParameterKind.ALTREP_PARAMETER);
-assert(retrieved_parameter2.as_ical_string() == parameter2.as_ical_string());
-retrieved_parameter3 = string_property.get_first_parameter(ICalGLib.ParameterKind.ACTIONPARAM_PARAMETER);
-assert(retrieved_parameter3.as_ical_string() == "ACTIONPARAM=This is a action param");
-
-string_property.remove_parameter_by_kind(ICalGLib.ParameterKind.CHARSET_PARAMETER);
-assert(string_property.count_parameters() == 3);
-string_property.remove_parameter_by_kind(ICalGLib.ParameterKind.ALTREP_PARAMETER);
-assert(string_property.count_parameters() == 2);
-string_property.remove_parameter_by_name("ACTIONPARAM");
-assert(string_property.count_parameters() == 1);
-
-kind = ICalGLib.ValueKind.ATTACH_VALUE;
-string = "This is a link";
-value_from_string = ICalGLib.Value.new_from_string(kind, string);
-string_property.set_value(value_from_string);
-string_from_property_api = string_property.get_value_as_string();
-assert(string_from_property_api == string);
-value_got_from_property = string_property.get_value();
-assert(value_got_from_property.as_ical_string() == string);
-string_property.set_value_from_string(string, ICalGLib.Value.kind_to_string(kind));
-string_from_property_api = string_property.get_value_as_string();
-assert(string_from_property_api == string);
-value_got_from_property = string_property.get_value();
-assert(value_got_from_property.as_ical_string() == string);
-
-string_property.set_x_name("This is an x name!");
-assert(string_property.get_x_name() == "This is an x name!");
-
-valuekind_from_parametervalue = ICalGLib.Parameter.value_to_value_kind(ICalGLib.ParameterValue.BINARY);
-assert(valuekind_from_parametervalue == ICalGLib.ValueKind.BINARY_VALUE);
-
-valuekind_from_property_kind = ICalGLib.Property.kind_to_value_kind(ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY);
-assert(valuekind_from_property_kind == ICalGLib.ValueKind.DATETIME_VALUE);
-propertyKind = ICalGLib.Value.kind_to_property_kind(valuekind_from_property_kind);
-assert(propertyKind == ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY);
-string = ICalGLib.Property.kind_to_string(ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY);
-assert(string == "ACKNOWLEDGED");
-kind = ICalGLib.Property.kind_from_string(string);
-assert(kind == ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY);
-
-string = ICalGLib.Property.method_to_string(ICalGLib.PropertyMethod.PUBLISH);
-assert(ICalGLib.Property.method_from_string(string) == ICalGLib.PropertyMethod.PUBLISH);
-
-string = ICalGLib.Property.enum_to_string(ICalGLib.PropertyMethod.PUBLISH);
-assert(string == "PUBLISH");
-
-#Test i_cal_value_set_parent. No error will be thrown.
-property_string = "SUMMARY:Bastille Day Party";
-string_property = ICalGLib.Property.new_from_string(property_string);
+actionProperty = ICalGLib.Property.new(ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY)
+actionPropertyClone = actionProperty.clone()
+assert actionPropertyClone.as_ical_string() == actionProperty.as_ical_string()
+
+propertyString = "SUMMARY:Bastille Day Party"
+stringProperty = ICalGLib.Property.new_from_string(propertyString)
+stringPropertyClone = stringProperty.clone()
+assert stringProperty.as_ical_string() == stringPropertyClone.as_ical_string()
+assert stringProperty.isa() == ICalGLib.PropertyKind.SUMMARY_PROPERTY
+assert stringProperty.isa_property() == 1
+assert stringProperty.get_property_name() == "SUMMARY"
+
+altrep1 = "This is an altrep 1"
+parameter1 = ICalGLib.Parameter.new_altrep(altrep1)
+altrep2 = "This is an altrep 2"
+parameter2 = ICalGLib.Parameter.new_altrep(altrep2)
+stringProperty.add_parameter(parameter1)
+stringProperty.add_parameter(parameter2)
+stringProperty.set_parameter_from_string("ACTIONPARAM", "This is a action param")
+
+assert stringProperty.count_parameters() == 3
+retrieved_parameter1 = stringProperty.get_first_parameter(ICalGLib.ParameterKind.ALTREP_PARAMETER)
+assert retrieved_parameter1.as_ical_string() == parameter1.as_ical_string()
+retrieved_parameter2 = stringProperty.get_next_parameter(ICalGLib.ParameterKind.ALTREP_PARAMETER)
+assert retrieved_parameter2.as_ical_string() == parameter2.as_ical_string()
+retrieved_parameter3 = stringProperty.get_first_parameter(ICalGLib.ParameterKind.ACTIONPARAM_PARAMETER)
+assert retrieved_parameter3.as_ical_string() == "ACTIONPARAM=This is a action param"
+
+stringProperty.remove_parameter_by_kind(ICalGLib.ParameterKind.CHARSET_PARAMETER)
+assert stringProperty.count_parameters() == 3
+stringProperty.remove_parameter_by_kind(ICalGLib.ParameterKind.ALTREP_PARAMETER)
+assert stringProperty.count_parameters() == 2
+stringProperty.remove_parameter_by_name("ACTIONPARAM")
+assert stringProperty.count_parameters() == 1
+
+kind = ICalGLib.ValueKind.ATTACH_VALUE
+string = "This is a link"
+value_from_string = ICalGLib.Value.new_from_string(kind, string)
+stringProperty.set_value(value_from_string)
+string_from_property_api = stringProperty.get_value_as_string()
+assert string_from_property_api == string
+value_got_from_property = stringProperty.get_value()
+assert value_got_from_property.as_ical_string() == string
+stringProperty.set_value_from_string(string, ICalGLib.Value.kind_to_string(kind))
+string_from_property_api = stringProperty.get_value_as_string()
+assert string_from_property_api == string
+value_got_from_property = stringProperty.get_value()
+assert value_got_from_property.as_ical_string() == string
+
+stringProperty.set_x_name("This is an x name!")
+assert stringProperty.get_x_name() == "This is an x name!"
+
+valuekind_from_parametervalue = ICalGLib.Parameter.value_to_value_kind(ICalGLib.ParameterValue.BINARY)
+assert valuekind_from_parametervalue == ICalGLib.ValueKind.BINARY_VALUE
+
+valuekind_from_property_kind = ICalGLib.Property.kind_to_value_kind(ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY)
+assert valuekind_from_property_kind == ICalGLib.ValueKind.DATETIME_VALUE
+propertyKind = ICalGLib.Value.kind_to_property_kind(valuekind_from_property_kind)
+assert propertyKind == ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY
+string = ICalGLib.Property.kind_to_string(ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY)
+assert string == "ACKNOWLEDGED"
+kind = ICalGLib.Property.kind_from_string(string)
+assert kind == ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY
+
+string = ICalGLib.Property.method_to_string(ICalGLib.PropertyMethod.PUBLISH)
+assert ICalGLib.Property.method_from_string(string) == ICalGLib.PropertyMethod.PUBLISH
+
+string = ICalGLib.Property.enum_to_string(ICalGLib.PropertyMethod.PUBLISH)
+assert string == "PUBLISH"
+
+# Test i_cal_value_set_parent. No error will be thrown.
+propertyString = "SUMMARY:Bastille Day Party"
+stringProperty = ICalGLib.Property.new_from_string(propertyString)
kind = ICalGLib.ValueKind.ATTACH_VALUE
string = "This is a link"
value_from_string = ICalGLib.Value.new_from_string(kind, string)
-value_from_string.set_parent(string_property)
+value_from_string.set_parent(stringProperty)
value_from_string.set_parent(None)
diff --git a/src/test/libical-glib/recurrence.py b/src/test/libical-glib/recurrence.py
index d00910ff..579101a9 100644
--- a/src/test/libical-glib/recurrence.py
+++ b/src/test/libical-glib/recurrence.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./recurrence-type.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./recurrence-type.py
###############################################################################
#
@@ -7,49 +7,47 @@
#
# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-#
-#
-#
###############################################################################
+''' Test Python bindings for libical recurrence '''
+
+from gi.repository import ICalGLib
import gi
gi.require_version('ICalGLib', '3.0')
-from gi.repository import ICalGLib
-
weekday = ICalGLib.Recurrence.day_day_of_week(0)
-assert(weekday == ICalGLib.RecurrenceWeekday.NO_WEEKDAY)
+assert weekday == ICalGLib.RecurrenceWeekday.NO_WEEKDAY
weekday = ICalGLib.Recurrence.day_day_of_week(1)
-assert(weekday == ICalGLib.RecurrenceWeekday.SUNDAY_WEEKDAY)
+assert weekday == ICalGLib.RecurrenceWeekday.SUNDAY_WEEKDAY
-assert(ICalGLib.Recurrence.day_position(15) == 1)
-assert(ICalGLib.Recurrence.day_position(16) == 2)
-assert(ICalGLib.Recurrence.day_position(25) == 3)
+assert ICalGLib.Recurrence.day_position(15) == 1
+assert ICalGLib.Recurrence.day_position(16) == 2
+assert ICalGLib.Recurrence.day_position(25) == 3
encoded = ICalGLib.Recurrence.encode_day(ICalGLib.RecurrenceWeekday.MONDAY_WEEKDAY, 0)
-assert(ICalGLib.Recurrence.day_day_of_week(encoded) == ICalGLib.RecurrenceWeekday.MONDAY_WEEKDAY)
-assert(ICalGLib.Recurrence.day_position(encoded) == 0)
+assert ICalGLib.Recurrence.day_day_of_week(encoded) == ICalGLib.RecurrenceWeekday.MONDAY_WEEKDAY
+assert ICalGLib.Recurrence.day_position(encoded) == 0
encoded = ICalGLib.Recurrence.encode_day(ICalGLib.RecurrenceWeekday.THURSDAY_WEEKDAY, -3)
-assert(ICalGLib.Recurrence.day_day_of_week(encoded) == ICalGLib.RecurrenceWeekday.THURSDAY_WEEKDAY)
-assert(ICalGLib.Recurrence.day_position(encoded) == -3)
+assert ICalGLib.Recurrence.day_day_of_week(encoded) == ICalGLib.RecurrenceWeekday.THURSDAY_WEEKDAY
+assert ICalGLib.Recurrence.day_position(encoded) == -3
encoded = ICalGLib.Recurrence.encode_day(ICalGLib.RecurrenceWeekday.FRIDAY_WEEKDAY, 2)
-assert(ICalGLib.Recurrence.day_day_of_week(encoded) == ICalGLib.RecurrenceWeekday.FRIDAY_WEEKDAY)
-assert(ICalGLib.Recurrence.day_position(encoded) == 2)
+assert ICalGLib.Recurrence.day_day_of_week(encoded) == ICalGLib.RecurrenceWeekday.FRIDAY_WEEKDAY
+assert ICalGLib.Recurrence.day_position(encoded) == 2
encoded = ICalGLib.Recurrence.encode_month(3, 0)
-assert(ICalGLib.Recurrence.month_month(encoded) == 3)
-assert(not ICalGLib.Recurrence.month_is_leap(encoded))
+assert ICalGLib.Recurrence.month_month(encoded) == 3
+assert not ICalGLib.Recurrence.month_is_leap(encoded)
encoded = ICalGLib.Recurrence.encode_month(12, 1)
-assert(ICalGLib.Recurrence.month_month(encoded) == 12)
-assert(ICalGLib.Recurrence.month_is_leap(encoded))
+assert ICalGLib.Recurrence.month_month(encoded) == 12
+assert ICalGLib.Recurrence.month_is_leap(encoded)
string = "COUNT=10;FREQ=DAILY"
recurrence = ICalGLib.Recurrence.new_from_string(string)
-assert(recurrence.to_string() == "FREQ=DAILY;COUNT=10")
+assert recurrence.to_string() == "FREQ=DAILY;COUNT=10"
by_second = recurrence.get_by_second_array()
# The value is dependent on the libical version.
@@ -83,7 +81,7 @@ assert recurrence.get_by_second(1) == ICalGLib.RecurrenceArrayMaxValues.RECURREN
array = recurrence.get_by_second_array()
assert array[0] == 1
assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 100, 101 ]
+array = [100, 101]
assert len(array) == 2
recurrence.set_by_second_array(array)
assert recurrence.get_by_second(0) == 100
@@ -101,7 +99,7 @@ assert recurrence.get_by_minute(1) == ICalGLib.RecurrenceArrayMaxValues.RECURREN
array = recurrence.get_by_minute_array()
assert array[0] == 2
assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 200, 201 ]
+array = [200, 201]
assert len(array) == 2
recurrence.set_by_minute_array(array)
assert recurrence.get_by_minute(0) == 200
@@ -119,7 +117,7 @@ assert recurrence.get_by_hour(1) == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE
array = recurrence.get_by_hour_array()
assert array[0] == 3
assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 300, 301 ]
+array = [300, 301]
assert len(array) == 2
recurrence.set_by_hour_array(array)
assert recurrence.get_by_hour(0) == 300
@@ -137,7 +135,7 @@ assert recurrence.get_by_day(1) == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_
array = recurrence.get_by_day_array()
assert array[0] == 4
assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 400, 401 ]
+array = [400, 401]
assert len(array) == 2
recurrence.set_by_day_array(array)
assert recurrence.get_by_day(0) == 400
@@ -155,7 +153,7 @@ assert recurrence.get_by_month_day(1) == ICalGLib.RecurrenceArrayMaxValues.RECUR
array = recurrence.get_by_month_day_array()
assert array[0] == 5
assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 500, 501 ]
+array = [500, 501]
assert len(array) == 2
recurrence.set_by_month_day_array(array)
assert recurrence.get_by_month_day(0) == 500
@@ -173,7 +171,7 @@ assert recurrence.get_by_year_day(1) == ICalGLib.RecurrenceArrayMaxValues.RECURR
array = recurrence.get_by_year_day_array()
assert array[0] == 6
assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 600, 601 ]
+array = [600, 601]
assert len(array) == 2
recurrence.set_by_year_day_array(array)
assert recurrence.get_by_year_day(0) == 600
@@ -191,7 +189,7 @@ assert recurrence.get_by_week_no(1) == ICalGLib.RecurrenceArrayMaxValues.RECURRE
array = recurrence.get_by_week_no_array()
assert array[0] == 7
assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 700, 701 ]
+array = [700, 701]
assert len(array) == 2
recurrence.set_by_week_no_array(array)
assert recurrence.get_by_week_no(0) == 700
@@ -209,7 +207,7 @@ assert recurrence.get_by_month(1) == ICalGLib.RecurrenceArrayMaxValues.RECURRENC
array = recurrence.get_by_month_array()
assert array[0] == 8
assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 800, 801 ]
+array = [800, 801]
assert len(array) == 2
recurrence.set_by_month_array(array)
assert recurrence.get_by_month(0) == 800
@@ -227,7 +225,7 @@ assert recurrence.get_by_set_pos(1) == ICalGLib.RecurrenceArrayMaxValues.RECURRE
array = recurrence.get_by_set_pos_array()
assert array[0] == 9
assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 900, 901 ]
+array = [900, 901]
assert len(array) == 2
recurrence.set_by_set_pos_array(array)
assert recurrence.get_by_set_pos(0) == 900
@@ -244,49 +242,49 @@ assert by_second[0] == 13
recurrence = ICalGLib.Recurrence.new_from_string(string)
-assert(ICalGLib.Recurrence.weekday_from_string("MO") == ICalGLib.RecurrenceWeekday.MONDAY_WEEKDAY)
+assert ICalGLib.Recurrence.weekday_from_string("MO") == ICalGLib.RecurrenceWeekday.MONDAY_WEEKDAY
start = 100000
result = ICalGLib.recur_expand_recurrence(string, start, 10)
-secs_per_day = 24*60*60
+secsPerDay = 24*60*60
for i in range(0, 9):
- assert(result[i] == start + i*secs_per_day)
+ assert result[i] == start + i*secsPerDay
string = "19970101T183248Z/19970102T071625Z"
period = ICalGLib.Period.new_from_string(string)
start = period.get_start()
-iter = ICalGLib.RecurIterator.new(recurrence, start)
-timetype = iter.next()
+iterator = ICalGLib.RecurIterator.new(recurrence, start)
+timetype = iterator.next()
day = timetype.get_day()
ref = 1
while day != 0:
- assert(day == ref)
+ assert day == ref
ref += 1
- timetype = iter.next()
+ timetype = iterator.next()
day = timetype.get_day()
recurrence = ICalGLib.Recurrence.new_from_string("FREQ=YEARLY;COUNT=10")
start = ICalGLib.Time.new_from_string("20161224T000000Z")
-iter = ICalGLib.RecurIterator.new(recurrence, start)
+iterator = ICalGLib.RecurIterator.new(recurrence, start)
start = ICalGLib.Time.new_from_string("20181224T000000Z")
-assert ICalGLib.RecurIterator.set_start(iter, start) == 0
+assert ICalGLib.RecurIterator.set_start(iterator, start) == 0
recurrence = ICalGLib.Recurrence.new_from_string("FREQ=YEARLY")
start = ICalGLib.Time.new_from_string("20161224T000000Z")
-iter = ICalGLib.RecurIterator.new(recurrence, start)
+iterator = ICalGLib.RecurIterator.new(recurrence, start)
start = ICalGLib.Time.new_from_string("20181224T000000Z")
-assert ICalGLib.RecurIterator.set_start(iter, start) == 1
-timetype = iter.next()
+assert ICalGLib.RecurIterator.set_start(iterator, start) == 1
+timetype = iterator.next()
assert timetype.get_year() == 2018
-timetype = iter.next()
+timetype = iterator.next()
assert timetype.get_year() == 2019
diff --git a/src/test/libical-glib/timezone.py b/src/test/libical-glib/timezone.py
index 88fb6b01..7e0be66f 100644
--- a/src/test/libical-glib/timezone.py
+++ b/src/test/libical-glib/timezone.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./timezone.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./timezone.py
###############################################################################
#
@@ -7,19 +7,17 @@
#
# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-#
-#
-#
###############################################################################
+''' Test Python bindings for libical timezone '''
+
+import sys
+import os
+from gi.repository import ICalGLib
import gi
gi.require_version('ICalGLib', '3.0')
-from gi.repository import ICalGLib
-
-import os
-import sys
try:
zoneinfodir = os.environ['ZONEINFO_DIRECTORY']
@@ -29,70 +27,70 @@ except KeyError:
if not os.path.isdir(zoneinfodir):
print("Error: The ZONEINFO_DIRECTORY environment variable isn't properly set")
sys.exit(1)
-ICalGLib.Timezone.set_zone_directory(zoneinfodir);
-ICalGLib.Timezone.set_tzid_prefix("/citadel.org/");
+ICalGLib.Timezone.set_zone_directory(zoneinfodir)
+ICalGLib.Timezone.set_tzid_prefix("/citadel.org/")
-la = ICalGLib.Timezone.get_builtin_timezone("America/Los_Angeles");
-chicago = ICalGLib.Timezone.get_builtin_timezone("America/Chicago");
-assert la.get_tzid().find("Los_Angeles") != -1;
-assert la.get_location() == "America/Los_Angeles";
-assert la.get_tznames() == "PST/PDT";
+la = ICalGLib.Timezone.get_builtin_timezone("America/Los_Angeles")
+chicago = ICalGLib.Timezone.get_builtin_timezone("America/Chicago")
+assert la.get_tzid().find("Los_Angeles") != -1
+assert la.get_location() == "America/Los_Angeles"
+assert la.get_tznames() == "PST/PDT"
-la_copy = la.copy();
-assert la_copy.get_tzid() == la.get_tzid();
-assert la_copy.get_location() == la.get_location();
+la_copy = la.copy()
+assert la_copy.get_tzid() == la.get_tzid()
+assert la_copy.get_location() == la.get_location()
-timezones = ICalGLib.Timezone.get_builtin_timezones();
-timezone = ICalGLib.Timezone.array_element_at(timezones, 0);
+timezones = ICalGLib.Timezone.get_builtin_timezones()
+timezone = ICalGLib.Timezone.array_element_at(timezones, 0)
if not ICalGLib.Timezone.get_builtin_tzdata():
- assert timezone.get_display_name() == "Europe/Andorra";
-assert timezones.size() > 0;
+ assert timezone.get_display_name() == "Europe/Andorra"
+assert timezones.size() > 0
-from_tzid = ICalGLib.Timezone.get_builtin_timezone_from_tzid(la.get_tzid());
-assert from_tzid.get_location() == "America/Los_Angeles";
+from_tzid = ICalGLib.Timezone.get_builtin_timezone_from_tzid(la.get_tzid())
+assert from_tzid.get_location() == "America/Los_Angeles"
-utc = ICalGLib.Timezone.get_utc_timezone();
-assert utc.get_display_name() == "UTC";
-utc2 = ICalGLib.Timezone.get_utc_timezone();
+utc = ICalGLib.Timezone.get_utc_timezone()
+assert utc.get_display_name() == "UTC"
+utc2 = ICalGLib.Timezone.get_utc_timezone()
assert utc == utc2
-time = ICalGLib.Time.new();
-before = time.get_hour();
-ICalGLib.Time.convert_timezone(time, la, chicago);
-after = time.get_hour();
-assert abs(after - before) == 2;
-ICalGLib.Time.set_timezone(time, utc);
-assert ICalGLib.Time.get_timezone(time) == utc;
-ICalGLib.Time.set_timezone(time, la);
-assert ICalGLib.Time.get_timezone(time) == la;
+time = ICalGLib.Time.new()
+before = time.get_hour()
+ICalGLib.Time.convert_timezone(time, la, chicago)
+after = time.get_hour()
+assert abs(after - before) == 2
+ICalGLib.Time.set_timezone(time, utc)
+assert ICalGLib.Time.get_timezone(time) == utc
+ICalGLib.Time.set_timezone(time, la)
+assert ICalGLib.Time.get_timezone(time) == la
timeclone = time.clone()
assert time != timeclone
time = ICalGLib.Time.convert_to_zone(time, chicago)
timeclone.convert_to_zone_inplace(chicago)
-assert time.get_year() == timeclone.get_year();
-assert time.get_month() == timeclone.get_month();
-assert time.get_day() == timeclone.get_day();
-assert time.get_hour() == timeclone.get_hour();
-assert time.get_minute() == timeclone.get_minute();
-assert time.get_second() == timeclone.get_second();
-assert time.get_timezone() == timeclone.get_timezone();
-assert time.is_date() == timeclone.is_date();
-assert time.is_daylight() == timeclone.is_daylight();
-assert time.is_utc() == timeclone.is_utc();
-
-timeclone = ICalGLib.Time.clone(time);
-assert time != timeclone;
-assert ICalGLib.Time.get_year(time) == ICalGLib.Time.get_year(timeclone);
-assert ICalGLib.Time.get_month(time) == ICalGLib.Time.get_month(timeclone);
-assert ICalGLib.Time.get_day(time) == ICalGLib.Time.get_day(timeclone);
-assert ICalGLib.Time.get_hour(time) == ICalGLib.Time.get_hour(timeclone);
-assert ICalGLib.Time.get_minute(time) == ICalGLib.Time.get_minute(timeclone);
-assert ICalGLib.Time.get_second(time) == ICalGLib.Time.get_second(timeclone);
-assert ICalGLib.Time.get_timezone(time) == ICalGLib.Time.get_timezone(timeclone);
-assert ICalGLib.Time.is_date(time) == ICalGLib.Time.is_date(timeclone);
-assert ICalGLib.Time.is_daylight(time) == ICalGLib.Time.is_daylight(timeclone);
-assert ICalGLib.Time.is_utc(time) == ICalGLib.Time.is_utc(timeclone);
+assert time.get_year() == timeclone.get_year()
+assert time.get_month() == timeclone.get_month()
+assert time.get_day() == timeclone.get_day()
+assert time.get_hour() == timeclone.get_hour()
+assert time.get_minute() == timeclone.get_minute()
+assert time.get_second() == timeclone.get_second()
+assert time.get_timezone() == timeclone.get_timezone()
+assert time.is_date() == timeclone.is_date()
+assert time.is_daylight() == timeclone.is_daylight()
+assert time.is_utc() == timeclone.is_utc()
+
+timeclone = ICalGLib.Time.clone(time)
+assert time != timeclone
+assert ICalGLib.Time.get_year(time) == ICalGLib.Time.get_year(timeclone)
+assert ICalGLib.Time.get_month(time) == ICalGLib.Time.get_month(timeclone)
+assert ICalGLib.Time.get_day(time) == ICalGLib.Time.get_day(timeclone)
+assert ICalGLib.Time.get_hour(time) == ICalGLib.Time.get_hour(timeclone)
+assert ICalGLib.Time.get_minute(time) == ICalGLib.Time.get_minute(timeclone)
+assert ICalGLib.Time.get_second(time) == ICalGLib.Time.get_second(timeclone)
+assert ICalGLib.Time.get_timezone(time) == ICalGLib.Time.get_timezone(timeclone)
+assert ICalGLib.Time.is_date(time) == ICalGLib.Time.is_date(timeclone)
+assert ICalGLib.Time.is_daylight(time) == ICalGLib.Time.is_daylight(timeclone)
+assert ICalGLib.Time.is_utc(time) == ICalGLib.Time.is_utc(timeclone)
time.set_date(2019, 1, 24)
assert time.get_year() == 2019
@@ -116,19 +114,19 @@ assert array[0] == 12
assert array[1] == 11
assert array[2] == 10
-component = la.get_component();
-timezone = ICalGLib.Timezone.new();
-timezone.set_component(ICalGLib.Component.clone(component));
-assert timezone.get_location() == la.get_location();
-
-array = ICalGLib.Timezone.array_new();
-ICalGLib.Timezone.array_append_from_vtimezone(array, ICalGLib.Component.clone(la.get_component()));
-ICalGLib.Timezone.array_append_from_vtimezone(array, ICalGLib.Component.clone(chicago.get_component()));
-assert array.size() == 2;
-timezone1 = ICalGLib.Timezone.array_element_at(array, 0);
-assert timezone1.get_display_name() == la.get_display_name();
-timezone2 = ICalGLib.Timezone.array_element_at(array, 1);
-assert timezone2.get_display_name() == chicago.get_display_name();
+component = la.get_component()
+timezone = ICalGLib.Timezone.new()
+timezone.set_component(ICalGLib.Component.clone(component))
+assert timezone.get_location() == la.get_location()
+
+array = ICalGLib.Timezone.array_new()
+ICalGLib.Timezone.array_append_from_vtimezone(array, ICalGLib.Component.clone(la.get_component()))
+ICalGLib.Timezone.array_append_from_vtimezone(array, ICalGLib.Component.clone(chicago.get_component()))
+assert array.size() == 2
+timezone1 = ICalGLib.Timezone.array_element_at(array, 0)
+assert timezone1.get_display_name() == la.get_display_name()
+timezone2 = ICalGLib.Timezone.array_element_at(array, 1)
+assert timezone2.get_display_name() == chicago.get_display_name()
ICalGLib.Timezone.free_builtin_timezones()
ICalGLib.Object.free_global_objects()
diff --git a/src/test/libical-glib/value.py b/src/test/libical-glib/value.py
index 0cebbb7b..8b7d07fb 100644
--- a/src/test/libical-glib/value.py
+++ b/src/test/libical-glib/value.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./value.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./value.py
###############################################################################
#
@@ -7,71 +7,70 @@
#
# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-#
-#
-#
###############################################################################
+''' Test Python bindings for libical value '''
+
+from gi.repository import ICalGLib
import gi
gi.require_version('ICalGLib', '3.0')
-from gi.repository import ICalGLib
-kind = ICalGLib.ValueKind.ATTACH_VALUE;
-value = ICalGLib.Value.new(kind);
-assert(value.is_valid() == 1);
-assert(value.isa() == kind);
-assert(value.isa_value() == 1);
+kind = ICalGLib.ValueKind.ATTACH_VALUE
+value = ICalGLib.Value.new(kind)
+assert value.is_valid() == 1
+assert value.isa() == kind
+assert value.isa_value() == 1
-string = "This is a link";
-value_from_string = ICalGLib.Value.new_from_string(kind, string);
-assert(value_from_string.as_ical_string() == string);
-assert(value_from_string.is_valid() == 1);
-assert(value_from_string.isa() == kind);
-assert(value_from_string.isa_value() == 1);
+string = "This is a link"
+value_from_string = ICalGLib.Value.new_from_string(kind, string)
+assert value_from_string.as_ical_string() == string
+assert value_from_string.is_valid() == 1
+assert value_from_string.isa() == kind
+assert value_from_string.isa_value() == 1
-value_from_string_clone = value_from_string.clone();
-assert(value_from_string_clone.as_ical_string() == string);
-assert(value_from_string_clone.is_valid() == 1);
-assert(value_from_string_clone.isa() == kind);
-assert(value_from_string_clone.isa_value() == 1);
+value_from_string_clone = value_from_string.clone()
+assert value_from_string_clone.as_ical_string() == string
+assert value_from_string_clone.is_valid() == 1
+assert value_from_string_clone.isa() == kind
+assert value_from_string_clone.isa_value() == 1
-value_a = ICalGLib.Value.new(ICalGLib.ValueKind.RECUR_VALUE);
-value_b = ICalGLib.Value.new(ICalGLib.ValueKind.ATTACH_VALUE);
-compare_result = ICalGLib.Value.compare(value_a, value_b);
-assert(compare_result == ICalGLib.ParameterXliccomparetype.NOTEQUAL);
+value_a = ICalGLib.Value.new(ICalGLib.ValueKind.RECUR_VALUE)
+value_b = ICalGLib.Value.new(ICalGLib.ValueKind.ATTACH_VALUE)
+compare_result = ICalGLib.Value.compare(value_a, value_b)
+assert compare_result == ICalGLib.ParameterXliccomparetype.NOTEQUAL
-string_a = "a string";
-string_b = "a string";
-value_a = ICalGLib.Value.new_from_string(kind, string_a);
-value_b = ICalGLib.Value.new_from_string(kind, string_b);
-compare_result = ICalGLib.Value.compare(value_a, value_b);
-assert(compare_result == ICalGLib.ParameterXliccomparetype.EQUAL);
+stringA = "a string"
+stringB = "a string"
+value_a = ICalGLib.Value.new_from_string(kind, stringA)
+value_b = ICalGLib.Value.new_from_string(kind, stringB)
+compare_result = ICalGLib.Value.compare(value_a, value_b)
+assert compare_result == ICalGLib.ParameterXliccomparetype.EQUAL
-string_a = "a string";
-string_b = "b string";
-value_a = ICalGLib.Value.new_from_string(kind, string_a);
-value_b = ICalGLib.Value.new_from_string(kind, string_b);
-compare_result = ICalGLib.Value.compare(value_a, value_b);
-assert(compare_result == ICalGLib.ParameterXliccomparetype.NOTEQUAL);
+stringA = "a string"
+stringB = "b string"
+value_a = ICalGLib.Value.new_from_string(kind, stringA)
+value_b = ICalGLib.Value.new_from_string(kind, stringB)
+compare_result = ICalGLib.Value.compare(value_a, value_b)
+assert compare_result == ICalGLib.ParameterXliccomparetype.NOTEQUAL
-kind_string = ICalGLib.Value.kind_to_string(kind);
-assert(kind_string == "ATTACH");
-converted_kind = ICalGLib.Value.kind_from_string(kind_string);
-assert(converted_kind == kind);
+kind_string = ICalGLib.Value.kind_to_string(kind)
+assert kind_string == "ATTACH"
+converted_kind = ICalGLib.Value.kind_from_string(kind_string)
+assert converted_kind == kind
-szText = "This is a text\nand this is a new line";
-after_encoded_szText = "This is a text\\nand this is a new line";
-before_decoded_szText = "This is a text\\\nand this is a new line";
-result = ICalGLib.Value.encode_ical_string(szText);
-assert(result == after_encoded_szText);
+szText = "This is a text\nand this is a new line"
+afterEncodedSZText = "This is a text\\nand this is a new line"
+beforeDecodedSZText = "This is a text\\\nand this is a new line"
+result = ICalGLib.Value.encode_ical_string(szText)
+assert result == afterEncodedSZText
-result = ICalGLib.Value.decode_ical_string(before_decoded_szText);
-assert(result == szText);
+result = ICalGLib.Value.decode_ical_string(beforeDecodedSZText)
+assert result == szText
-szText = "Simple text";
-result = ICalGLib.Value.encode_ical_string(szText);
+szText = "Simple text"
+result = ICalGLib.Value.encode_ical_string(szText)
assert result == szText
-result = ICalGLib.Value.decode_ical_string(result);
+result = ICalGLib.Value.decode_ical_string(result)
assert result == szText