Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to python 3.11 #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

#ignore local enviroment
/env
*.pyc
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "tests/main.py",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"python.testing.unittestArgs": [
"-v",
"-s",
"./tests",
"-p",
"**.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true,
"files.exclude": {
"**/.git": true,
"**/__pycache__": true,
"**/utils":true
}
}
8 changes: 4 additions & 4 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
PureMVC Standard Framework for Python (Ported)
PureMVC Standard Framework for Python (Ported)
--------------------------------------------------------------------------
Release Date: 03/16/09
Platform: Python 2.5
Platform: Python 3.11
Version: 1
Revision: 2
Revision: 4
Minor: 0
Author: Toby de Havilland <[email protected]>
--------------------------------------------------------------------------

1.4 - * Fixed iteraion in dict and Tests to be identified by vscode
1.3 - * Fixed name clashes with built-in types
* Refactored unit test primer to auto-load unit tests
* Fixed bug in MacroCommand.execute() where the list of commands was
Expand Down
10 changes: 9 additions & 1 deletion src/puremvc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,14 +369,22 @@ def removeMediator(self, mediatorName):
@param mediatorName: name of the C{IMediator} instance to be removed.
@return: the C{IMediator} that was removed from the C{View}
"""

deleteList=[]#list to collect all items needed to be delete

for notificationName in self.observerMap.keys():
observers = self.observerMap[notificationName]
for i in range(len(observers)-1, -1, -1):
if observers[i].compareNotifyContext(self.retrieveMediator(mediatorName)) == True:
observers.pop(i)

if len(observers) == 0:
del self.observerMap[notificationName]
deleteList.append(notificationName)#instead of delete put on a list
#del self.observerMap[notificationName]

#delete all in once to avoid error of collection change
for item in deleteList:
del self.observerMap[item]

mediator = self.mediatorMap.get(mediatorName)

Expand Down
4 changes: 4 additions & 0 deletions tests/core/controller.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import unittest
import sys

sys.path.insert(1, "src")

import puremvc.interfaces
import puremvc.patterns.observer
import puremvc.core
Expand Down
3 changes: 3 additions & 0 deletions tests/core/model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import unittest
import sys

sys.path.insert(1, "src")

import puremvc.interfaces
import puremvc.patterns.proxy
Expand Down
3 changes: 3 additions & 0 deletions tests/core/view.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import unittest
import sys

sys.path.insert(1, "src")

import puremvc.interfaces
import puremvc.patterns.observer
Expand Down
6 changes: 4 additions & 2 deletions tests/patterns/command.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import unittest
import sys

sys.path.insert(1, "src")
import puremvc.patterns.observer
import utils.command

Expand All @@ -12,7 +14,7 @@ def testMacroCommandExecute(self):
vo = utils.command.MacroCommandTestVO(5)
note = puremvc.patterns.observer.Notification('MacroCommandTest', vo)
command = utils.command.MacroCommandTestCommand()
command.execute(note);
command.execute(note)

self.assertEqual(True, vo.result1 == 10)
self.assertEqual(True, vo.result2 == 25)
Expand All @@ -23,6 +25,6 @@ def testSimpleCommandExecute(self):
vo = utils.command.SimpleCommandTestVO(5)
note = puremvc.patterns.observer.Notification('SimpleCommandTestNote', vo)
command = utils.command.SimpleCommandTestCommand()
command.execute(note);
command.execute(note)

self.assertEqual(True, vo.result == 10)
2 changes: 2 additions & 0 deletions tests/patterns/facade.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import unittest
import sys

sys.path.insert(1, "src")
import puremvc.interfaces
import puremvc.patterns.proxy
import puremvc.patterns.mediator
Expand Down
2 changes: 2 additions & 0 deletions tests/patterns/mediator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import unittest
import sys

sys.path.insert(1, "src")
import puremvc.patterns.mediator as mediator

class MediatorTest(unittest.TestCase):
Expand Down
2 changes: 2 additions & 0 deletions tests/patterns/observer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import unittest
import sys

sys.path.insert(1, "src")
import puremvc.patterns.observer

class ObserverTest(unittest.TestCase):
Expand Down
2 changes: 2 additions & 0 deletions tests/patterns/proxy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import unittest
import sys

sys.path.insert(1, "src")
import puremvc.patterns.proxy

class ProxyTest(unittest.TestCase):
Expand Down