diff --git a/Demos/Demo25/VarPythUnitTest.dproj b/Demos/Demo25/VarPythUnitTest.dproj index a913f106..e0ad0fb0 100644 --- a/Demos/Demo25/VarPythUnitTest.dproj +++ b/Demos/Demo25/VarPythUnitTest.dproj @@ -1,136 +1,162 @@ - - - {F6960501-E313-4232-96B9-EA62FB351D5E} - VarPythUnitTest.dpr - Debug - DCC32 - 13.4 - VCL - True - Win64 - 3 - Application - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;$(DCC_Namespace) - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 1033 - VarPythUnitTest.exe - 00400000 - x86 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - true - $(BDS)\bin\default_app.manifest - - - false - RELEASE;$(DCC_Define) - 0 - false - - - DEBUG;$(DCC_Define) - - - None - - - - MainSource - - -
TMain
-
- - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - - Delphi.Personality.12 - VCLApplication - - - - VarPythUnitTest.dpr - - - False - True - False - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1033 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - - - - True - True - - - 12 - - -
+ + + {F6960501-E313-4232-96B9-EA62FB351D5E} + VarPythUnitTest.dpr + Debug + DCC32 + 19.1 + VCL + True + Win64 + 3 + Application + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;$(DCC_Namespace) + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + 1033 + VarPythUnitTest.exe + 00400000 + x86 + VarPythUnitTest + + + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + $(BDS)\bin\delphi_PROJECTICON.ico + (None) + + + Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + true + $(BDS)\bin\default_app.manifest + true + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + $(BDS)\bin\delphi_PROJECTICON.ico + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + DEBUG;$(DCC_Define) + + + None + Debug + + + Debug + true + true + PerMonitorV2 + + + + MainSource + + +
TMain
+
+ + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + +
+ + + Delphi.Personality.12 + VCLApplication + + + + VarPythUnitTest.dpr + + + False + True + False + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + + + True + True + + + 12 + + +
diff --git a/Demos/Demo25/VarPythUnitTest.res b/Demos/Demo25/VarPythUnitTest.res index 15f1ffe5..19edda78 100644 Binary files a/Demos/Demo25/VarPythUnitTest.res and b/Demos/Demo25/VarPythUnitTest.res differ diff --git a/Demos/Demo25/fmMain.dfm b/Demos/Demo25/fmMain.dfm index db67206a..97f5305e 100644 --- a/Demos/Demo25/fmMain.dfm +++ b/Demos/Demo25/fmMain.dfm @@ -32,6 +32,13 @@ object Main: TMain Width = 753 Height = 249 Align = alTop + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Consolas' + Font.Pitch = fpVariable + Font.Style = [] + ParentFont = False ScrollBars = ssVertical TabOrder = 0 end @@ -234,6 +241,12 @@ object Main: TMain Width = 753 Height = 166 Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Consolas' + Font.Pitch = fpVariable + Font.Style = [] Lines.Strings = ( 'class XYZ(object):' ' pass' @@ -242,7 +255,7 @@ object Main: TMain ' def __init__(Self, Value=0):' ' Self.Value = Value' ' def __del__(Self):' - ' print "delete", Self' + ' print ("delete", Self)' ' def __add__(self, other):' ' return Foo(self.Value + other.Value)' ' def Inc(Self, AValue = 1):' @@ -266,12 +279,13 @@ object Main: TMain ' return [a, b, c, d]' '' 'f = Foo()' - 'print "Created", f' + 'print ("Created", f)' 'f.Inc()' 'f.Inc(2)' 'b = Bar()' 'b.Inc()' 'b.Inc(2)') + ParentFont = False ScrollBars = ssVertical TabOrder = 2 end diff --git a/Demos/Demo25/fmMain.pas b/Demos/Demo25/fmMain.pas index 13c68621..90b02a1a 100644 --- a/Demos/Demo25/fmMain.pas +++ b/Demos/Demo25/fmMain.pas @@ -105,7 +105,7 @@ procedure TMain.btnTestIntegersClick(Sender: TObject); // check that operation did not change the content of operands. Assert(Integer(a) = 2); Assert(Integer(b) = 3); - // now with a litteral + // now with a literal c := a + b + 1; Assert( Integer(c) = 6 ); c := a + 1 + b; @@ -116,7 +116,7 @@ procedure TMain.btnTestIntegersClick(Sender: TObject); // substraction c := b - a; Assert( Integer(c) = 1 ); - // now with a litteral + // now with a literal c := b - a - 1; Assert( Integer(c) = 0 ); c := b - 1 - a; @@ -127,7 +127,7 @@ procedure TMain.btnTestIntegersClick(Sender: TObject); // multiplication c := a * b; Assert( Integer(c) = 6 ); - // now with a litteral + // now with a literal c := a * b * 2; Assert( Integer(c) = 12 ); c := a * 2 * b; @@ -302,7 +302,7 @@ procedure TMain.btnTestFloatsClick(Sender: TObject); // check that operation did not change the content of operands. Assert(Double(a) = dbl_a); Assert(Double(b) = dbl_b); - // now with a litteral + // now with a literal c := a + b + 1; Assert( Double(c) = (dbl_a+dbl_b+1) ); c := a + 1 + b; @@ -313,7 +313,7 @@ procedure TMain.btnTestFloatsClick(Sender: TObject); // substraction c := b - a; Assert( Double(c) = (dbl_b - dbl_a) ); - // now with a litteral + // now with a literal c := b - a - 1; Assert( Double(c) = (dbl_b-dbl_a-1) ); c := b - 1 - a; @@ -325,7 +325,7 @@ procedure TMain.btnTestFloatsClick(Sender: TObject); c := a * b; dbl_c := dbl_a * dbl_b; Assert( Double(c) = dbl_c ); - // now with a litteral + // now with a literal c := a * b * 2; dbl_c := dbl_a * dbl_b * 2; Assert( Double(c) = dbl_c ); @@ -427,7 +427,7 @@ procedure TMain.btnTestStringsClick(Sender: TObject); // check that operation did not change the content of operands. Assert(String(a) = 'abc'); Assert(String(b) = 'def'); - // now with a litteral + // now with a literal c := a + b + '!'; Assert( String(c) = 'abcdef!' ); c := a + '!' + b; @@ -583,7 +583,7 @@ procedure TMain.btnTestSequencesClick(Sender: TObject); // check that operation did not change the content of operands. Assert(String(a) = '[1, 2, 3]'); Assert(String(b) = '[4, 5, 6]'); - // now with a litteral: note that with D6 SP1, we can't concatenate a custom variant with an var array of variants + // now with a literal: note that with D6 SP1, we can't concatenate a custom variant with a var array of variants c := a + b + VarPythonCreate(['Hello', 'World!', 3.14]); Assert( String(c) = '[1, 2, 3, 4, 5, 6, u''Hello'', u''World!'', 3.1400000000000001]' ); c := a + VarPythonCreate(['Hello', 'World!', 3.14]) + b; @@ -642,7 +642,7 @@ procedure TMain.btnTestSequencesClick(Sender: TObject); // sequence methods: c := b + a; - c.sort(); // note that you must you the parenthesis to distinguish the call between a method or a property. + c.sort(); // note that you must use the parenthesis to distinguish the call between a method or a property. Assert( c = (a+b) ); c := NewPythonList; // facility for building sequences @@ -770,8 +770,8 @@ procedure TMain.btnTestMappingsClick(Sender: TObject); Assert( VarIsSame(c, a) ); // checks if 2 variants share the same Python object. // dict methods - Assert( Boolean(a.has_key(string('a'))) ); - Assert( not Boolean(a.has_key('abc')) ); + Assert( Boolean(a.get(string('a'))) ); + Assert( not Boolean(a.get('abc')) ); keys := a.keys(); keys.sort(); Assert( keys = VarPythonCreate(VarArrayOf(['a', 'b', 'c']))); @@ -780,7 +780,7 @@ procedure TMain.btnTestMappingsClick(Sender: TObject); Assert( values = VarPythonCreate(VarArrayOf([1, 2, 3]))); c := a; c.DeleteItem(string('a')); - Assert( not Boolean(c.has_key(string('a'))) ); + Assert( not Boolean(c.get(string('a'))) ); // test string values a := NewPythonDict; @@ -831,7 +831,7 @@ procedure TMain.btnTestDatesClick(Sender: TObject); Assert( b.GetItem(6) = a.GetItem(6) ); Assert( b.GetItem(7) = a.GetItem(7) ); // don't test the 9th item of the tuple, because it's the daylight saving, - // and it's not computed by the Python for Delphi. + // and it's not computed by Python for Delphi. //Assert( b.GetItem(8) = a.GetItem(8) ); _date2 := b; @@ -986,7 +986,7 @@ procedure TMain.btnTestObjectsClick(Sender: TObject); Assert( VarIsPythonModule(_main) ); Assert( VarIsPythonModule(SysModule) ); Assert( Import('sys').version = SysModule.version ); - Assert( Boolean(SysModule.modules.has_key(GetPythonEngine.ExecModule)) ); // if __main__ in sys.modules + Assert( Boolean(SysModule.modules.get(GetPythonEngine.ExecModule)) ); // if __main__ in sys.modules Assert( VarIsSameType(_main, SysModule) ); Assert( _type(_main).__name__ = 'module'); Assert( BuiltinModule.type(_main).__name__ = 'module'); @@ -1013,7 +1013,7 @@ procedure TMain.btnTestObjectsClick(Sender: TObject); Assert( not VarIsSubclassOf(_main.Foo, _main.Bar) ); Assert( VarIsInstanceOf(_main.b, _main.Foo) ); Assert( not VarIsInstanceOf(_main.f, _main.Bar) ); - Assert( VarIsTrue( BuiltinModule.vars(_main).has_key(string('f')) ) ); + Assert( VarIsTrue( BuiltinModule.vars(_main).get(string('f')) ) ); Assert( VarIsTrue( BuiltinModule.dir(_main).Contains(string('f')) ) ); f := _main.Foo(); // new instance of class Foo @@ -1037,10 +1037,10 @@ procedure TMain.btnTestObjectsClick(Sender: TObject); Log('Test -> a, b, c : ' + a.Value + ', ' + b.Value + ', ' + c.Value); // cascading calls Assert( f.GetSelf().GetSelf().GetSelf().GetSelf().GetValue() = _main.f.GetValue() ); - Assert( Boolean(f.__dict__.has_key('Value')) ); + Assert( Boolean(f.__dict__.get('Value')) ); Assert( VarIsTrue( BuiltinModule.hasattr(f, 'Value') ) ); _str := 'Value'; - Assert( Boolean(f.__dict__.has_key(_str)) ); // check with a string var + Assert( Boolean(f.__dict__.get(_str)) ); // check with a string var Assert( Boolean( BuiltinModule.hasattr(f, _str) ) ); val := f.Value; f.Add(f); // passing itself as an argument @@ -1119,7 +1119,7 @@ procedure TMain.btnTestObjectsClick(Sender: TObject); Assert( _myModule.Add(2, 2) = 4 ); // delete module var f _main.__dict__.DeleteItem(string('f')); - Assert( _main.__dict__.has_key(string('f')) = False ); + Assert( _main.__dict__.get(string('f')) = False ); // open a file using Python if FileExists('MyModule.py') then begin