YT-Spammer-Purge icon indicating copy to clipboard operation
YT-Spammer-Purge copied to clipboard

test exclude_authors

Open rachmadaniHaryono opened this issue 2 years ago • 13 comments

Related Issue/Addition to code

Please delete options that are not relevant.

  • Fixes #
  • Issue/Addition to code, goes here.

test exclude_authors

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Proposed Changes

  • test Scripts.operations.exclude_author
  • type hint for Scripts.operations.exclude_author based on that test (for function parameter and result)
  • move comment to function docstring
  • set default value for addWhitelist var
  • handle error when S.R is not recognizeable
  • document raised error when calling sys.exit

Additional Info

  • what is default value for result, addWhitelist, chosenSampleIndexes variable?
  • i recommend to use isort to sort import
  • change on main program is not formatted for now,
  • maybe move while loop to a new function so it is easier to test and separate user input and logic section
  • on YTSpammerPurge.py there is aliasing to Style, Fore and Back object attribute but this make import submodule harder
  # Initiates colorama and creates shorthand variables for resetting colors
  init(autoreset=True)
  S.R = S.RESET_ALL
  F.R = F.RESET
  B.R = B.RESET
  • to run the test, install pytest and run it with pytest -s. if you use it with poetry run poetry run pytest -s. see https://github.com/ThioJoe/YT-Spammer-Purge/pull/459 to get pyproject.toml file
  • what is the type for current, excludedCommentsDict, authorsToExcludeSet, commentIDExcludeSet? maybe current type hint from this pr is wrong?
  • Scripts/operations.pyi is generated from mypy's stubgen with little change
    • this is already good enough than inital handcrafted type hint guess
  • from contributing.md
    • it is simpler pr
    • Avoid adding new non-standard libraries if at all possible, but i use pytest rather than unittest for easier test and avoid boilerplate

i tried brute testing program on https://github.com/ThioJoe/YT-Spammer-Purge/pull/476 but it failed

i think it is easier to test recent function from recent repo commit and keep it as small as possible

pyright result moved to comment below

Checklist:

  • [x] My code follows the style guidelines of this project and have read CONTRIBUTING.md
  • [x] I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • [x] I have checked my code and corrected any misspellings

Screenshots

Original Updated
** original screenshot ** updated screenshot **

rachmadaniHaryono avatar Feb 04 '22 05:02 rachmadaniHaryono

on YTSpammerPurge.py there is aliasing to Style, Fore and Back object attribute but this make import submodule harder

I tried to fix this in #510 by moving the alias to the shared_import file, if #510 is not merged, the alias should definitely at least be moved.

ethnh avatar Feb 04 '22 06:02 ethnh

if #510 accepted i will remove that part from pr

rachmadaniHaryono avatar Feb 04 '22 06:02 rachmadaniHaryono

but i use pytest rather than unittest for easier test and avoid boilerplate

As long as it doesn't need to be added to requirements.txt, I doubt @ThioJoe would mind Running tests should generally be done before releasing anyway, no need to run tests on every run 👍

ethnh avatar Feb 04 '22 06:02 ethnh

i forget to document SytemExit when the function calling sys.exit

https://github.com/ThioJoe/YT-Spammer-Purge/blob/224bb22306fa3d354c94c43b0ea048abf8ce903a/Scripts/operations.py#L880

there is also error on type hint for miscData

it should be some object with resources attribute, which is a dict

https://github.com/ThioJoe/YT-Spammer-Purge/blob/224bb22306fa3d354c94c43b0ea048abf8ce903a/Scripts/operations.py#L899

i also forget to write type hint for return value tuple

it should be the same as type hint as stated on function parameter

rachmadaniHaryono avatar Feb 04 '22 07:02 rachmadaniHaryono

I have no clue what this is

ThioJoe avatar Feb 05 '22 00:02 ThioJoe

unit test for the function (?)

rachmadaniHaryono avatar Feb 05 '22 00:02 rachmadaniHaryono

This is way over my head

ThioJoe avatar Feb 05 '22 00:02 ThioJoe

how do you test the program?

how do you make sure the function work as intended?

rachmadaniHaryono avatar Feb 05 '22 00:02 rachmadaniHaryono

how do you test the program?

how do you make sure the function work as intended?

I usually just try to make functions have a simple purpose so there aren't too many situations to test. Then I just see if it behaves as expected and try to come up with edge cases myself.

ThioJoe avatar Feb 05 '22 17:02 ThioJoe

I usually just try to make functions have a simple purpose so there aren't too many situations to test.

currently some function have comment that describe its function (and some dont)

but some (if not all) don't have description about parameter input , return value and raised error

take exclude_authors for example

  • can you describe parameter and its type?
  • does it raises exception?
  • from description Removes comments by user-selected authors from list of comments to delete but it doesn't state that it will write to a file https://github.com/ThioJoe/YT-Spammer-Purge/blob/3b9fb62e9abac57676dda08b40b84161f94cf8e0/Scripts/operations.py#L899

despite the goal of functions have a simple purpose, it clearly not what happen

so there aren't too many situations to test

with so many branching on function i doubt that

Then I just see if it behaves as expected and try to come up with edge cases myself.

manually?

so basically run it from main function?

have you try run the function by itself? for example

from Scripts import some_module

some_module.some_function(*args, **kwargs)

rachmadaniHaryono avatar Feb 05 '22 23:02 rachmadaniHaryono

I've been looking up how unit testing works so I am starting to see the point of this. Gonna take me a bit to delve into it though

ThioJoe avatar Feb 08 '22 20:02 ThioJoe

Scripts/operations.pyi is generated from mypy's stubgen

i also add from typing import Union

test is also matched with current exclude_authors return variable


initial pyright

No configuration file found.
pyproject.toml file found at /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge.
Loading pyproject.toml file at /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/pyproject.toml
Assuming Python platform Linux
Searching for source files
Found 1 source file
/mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:49:55 - error: Cannot access member "id" for type "None"
    Member "id" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:67:28 - error: "results" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:71:15 - error: "results" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:133:68 - error: "videoID" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:295:25 - error: Cannot access member "id" for type "None"
    Member "id" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:350:23 - error: Cannot access member "id" for type "None"
    Member "id" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:674:44 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:730:36 - error: "results" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:738:36 - error: "results" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:788:85 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:811:77 - error: "group" is not a known member of "None" (reportOptionalMemberAccess)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:814:77 - error: "group" is not a known member of "None" (reportOptionalMemberAccess)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:822:14 - error: "result" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:825:49 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:838:53 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:850:10 - error: Operator "in" not supported for types "str" and "Unbound | list[str]"
    Operator "in" not supported for types "str" and "Unbound" (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:850:32 - error: "chosenSampleIndexes" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:853:10 - error: Operator "not in" not supported for types "str" and "Unbound | list[str]"
    Operator "not in" not supported for types "str" and "Unbound" (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:853:36 - error: "chosenSampleIndexes" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:879:44 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:880:49 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:890:64 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:890:102 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:890:141 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:895:53 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:895:98 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:903:24 - error: Cannot access member "resources" for type "Dict[str, Any]"
    Member "resources" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:943:49 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:943:93 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:972:8 - error: Index 3 is out of range for type tuple[None, None, Literal['MainMenu']] (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:981:9 - error: Expression with type "tuple[None, None, Literal['MainMenu']] | tuple[Unknown | Literal['End'], int | None, int | Literal['MainMenu'], Literal['']]" cannot be assigned to target tuple
    Type "tuple[None, None, Literal['MainMenu']]" is incompatible with target tuple
      Element size mismatch; expected 4 but received 3 (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:979:9 - error: Expression with type "tuple[None, None, Literal['MainMenu']] | tuple[Unknown | Literal['End'], int | None, int | Literal['MainMenu'], Literal['']]" cannot be assigned to target tuple
    Type "tuple[None, None, Literal['MainMenu']]" is incompatible with target tuple
      Element size mismatch; expected 4 but received 3 (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:982:14 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1005:68 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1005:115 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1005:172 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1007:68 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1007:115 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1007:172 - error: Cannot access member "R" for type "AnsiStyle"
    Member "R" is unknown (reportGeneralTypeIssues)
39 errors, 0 warnings, 0 informations 
Completed in 1.963sec
pyright after 3ee9a3cff507b0417022ab79d5611bc8877572ca

No configuration file found.
pyproject.toml file found at /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge.
Loading pyproject.toml file at /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/pyproject.toml
Assuming Python platform Linux
Searching for source files
Found 1 source file
/mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:4:36 - warning: Wildcard import from a library not allowed (reportWildcardImportFromLibrary)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:55:5 - error: "traceback" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:60:5 - error: "traceback" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:66:28 - error: "results" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:70:15 - error: "results" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:141:73 - error: "videoID" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:174:9 - error: "traceback" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:179:9 - error: "traceback" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:284:105 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:286:53 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:299:14 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:305:21 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:319:19 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:327:17 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:408:8 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:485:3 - error: "dictToUse" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:495:5 - error: "dictToUse" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:496:5 - error: "dictToUse" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:497:5 - error: "dictToUse" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:647:12 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:660:12 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:678:12 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:680:14 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:685:10 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:723:18 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:738:18 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:749:21 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:754:27 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:773:16 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:775:56 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:787:12 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:791:26 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:834:12 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:842:16 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:851:16 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:908:7 - error: "sys" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:937:14 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:937:42 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:993:36 - error: "results" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1001:36 - error: "results" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1051:20 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1051:83 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1070:18 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1071:13 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1071:21 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1082:24 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1090:21 - error: "replace" is not a known member of "None" (reportOptionalMemberAccess)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1079:24 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1090:14 - error: "result" is possibly unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1092:8 - error: "re" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1093:18 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1093:47 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1102:36 - error: Cannot access member "split" for type "None"
    Member "split" is unknown (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1106:22 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1106:51 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1118:10 - error: Operator "in" not supported for types "str" and "Unbound"
    Operator "in" not supported for types "str" and "Unbound" (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1118:32 - error: "chosenSampleIndexes" is unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1121:10 - error: Operator "not in" not supported for types "str" and "Unbound"
    Operator "not in" not supported for types "str" and "Unbound" (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1121:36 - error: "chosenSampleIndexes" is unbound (reportUnboundVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1165:16 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1165:42 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1166:27 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1166:47 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1169:7 - error: "sys" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1176:14 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1176:62 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1176:77 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1176:100 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1176:114 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1176:139 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1181:26 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1181:51 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1181:70 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1181:96 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1219:18 - error: "B" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1219:28 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1219:47 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1219:53 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1219:91 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1248:8 - error: Index 3 is out of range for type tuple[None, None, Literal['MainMenu']] (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1257:9 - error: Expression with type "tuple[None, None, Literal['MainMenu']] | tuple[Any | Literal['End'], int | None, int | Literal['MainMenu'], Literal['']]" cannot be assigned to target tuple
    Type "tuple[None, None, Literal['MainMenu']]" is incompatible with target tuple
      Element size mismatch; expected 4 but received 3 (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1255:9 - error: Expression with type "tuple[None, None, Literal['MainMenu']] | tuple[Any | Literal['End'], int | None, int | Literal['MainMenu'], Literal['']]" cannot be assigned to target tuple
    Type "tuple[None, None, Literal['MainMenu']]" is incompatible with target tuple
      Element size mismatch; expected 4 but received 3 (reportGeneralTypeIssues)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1258:14 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1281:44 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1281:66 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1281:91 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1281:113 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1281:143 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1281:170 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1283:44 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1283:66 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1283:91 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1283:113 - error: "S" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1283:143 - error: "F" is not defined (reportUndefinedVariable)
  /mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/YT-Spammer-Purge/Scripts/operations.py:1283:170 - error: "S" is not defined (reportUndefinedVariable)
94 errors, 1 warning, 0 informations 
Completed in 1.658sec

https://github.com/ThioJoe/YT-Spammer-Purge/pull/536#issuecomment-1029696873

@EthanHindmarsh pr #510 is already merged but it is merged to beta branch

but this pr is based on main branch, so imo this should be merged after beta branch is merged to main branch

after that i will remove the relevant section and test it again


e:

to generate pyi files stubgen Scripts -o Scripts

there is error when i add YTSpammerPurge to above command

Critical error during semantic analysis: YTSpammerPurge.py: error: INTERNAL ERROR: maximum semantic analysis iteration count reached

rachmadaniHaryono avatar Feb 14 '22 02:02 rachmadaniHaryono

I've been looking up how unit testing works so I am starting to see the point of this. Gonna take me a bit to delve into it though

Do you have any questions? Tests are currently listed as part of the PR process so it would be great to have some sort of testing added👍

ethnh avatar Mar 20 '22 21:03 ethnh