unittest.sh

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
this CR is to old and obsolete.

this CR is to old and obsolete.

SCRIPTS-DEN-2793_Addcommonrepositorytotheuiprojectandrefactorcurrentcodes
SCRIPTS-DEN-2793_Addcommonrepositorytotheuiprojectandrefactorcurrentcodes
RESOLVED

RESOLVED

Hey Peter, Thanks for the comments and all the testing . This function doesn't mean to be used the way you tested it. But anyway I came up with a better solution. def partition(vString, vPart, vRig...

Hey Peter,
Thanks for the comments and all the testing .
This function doesn't mean to be used the way you tested it.
But anyway I came up with a better solution.

def partition(vString, vPart, vRightDirection=True):
    return [vString[i: i + vPart] for i in range(0, len(vString), vPart)][::-1 if vRightDirection else 1]

Actually my first thought was not correct on how this portion of the code should work.

def partition_orig(vString, vPart, vRightDirection = True): if vRightDirection: list = [vString[i - vPart : i] for i in range(len(vString), 0, -vPart)] else: list = [vStrin...

def partition_orig(vString, vPart, vRightDirection = True):
    if vRightDirection:
        list = [vString[i - vPart : i] for i in range(len(vString), 0, -vPart)]
    else:
        list = [vString[i : i + vPart] for i in range(0, len(vString), vPart)]
    return list


def partition_2(vString, vPart, vRightDirection = True):
    if vRightDirection:
        vString = vString[::-1]
    return [vString[i : i + vPart][::-1] for i in range(0, len(vString), vPart)]

print(partition_orig("TESTING123", 3))
print(partition_2("TESTING123", 3))

                  


Outputs:

['123', 'ING', 'EST', '']
['123', 'ING', 'EST', 'T']


whereas

def partition_2(vString, vPart, vRightDirection = True):
    if vRightDirection:
        vString = vString[::-1]
    return [vString[i : i + vPart] for i in range(0, len(vString), vPart)]


outputs

['321', 'GNI', 'TSE', 'T']


I think you're saying you want to do the second one right? I think that would be better too!

Edit: Also I don't think you need the mString because in python immutable types (e.g. string, number, tuple) behave like call by value

I came out with the solution below : def partition1(vString, vPart, vRightDirection=True): mString = vString if vRightDirection: mString = vString[::-1] else: mString = vString list = [mString[i: ...

I came out with the solution below :

def partition1(vString, vPart, vRightDirection=True):
mString = vString
if vRightDirection:
mString = vString[::-1]
else:
mString = vString
list = [mString[i: i + vPart] for i in range(0, len(mString), vPart)]
return list

if _name_ == "_main_":
vString = "TESTING"
vPart = 3

list = partition1(vString, vPart, True)
print(list)


list = partition1(vString, vPart, False)
print(list)

// ----- Output ----- :
['GNI', 'TSE', 'T']
['TES', 'TIN', 'G']

which is exactly what I want.
I'm gonna push changes if you agree.

Thank you so much Peter. This is exactly the kind of code review I really like. I looked at the code you sent and tried to test it. At a first glance I saw a misbehavior. your code is partition2. ...

Thank you so much Peter.
This is exactly the kind of code review I really like.
I looked at the code you sent and tried to test it.
At a first glance I saw a misbehavior.

your code is partition2.
list = partition2("TESTING", 2, False)
print(list)

list = partition("TESTING", 2, False)
print(list)
// —
The output is different :
['ET', 'TS', 'NI', 'G'] partition2
['TE', 'ST', 'IN', 'G'] partition

so the output is unexpected.

partition("TESTING123", 3) will return ['123', 'ING', 'EST', ''] which is missing a character. Also, partition("TESTING123", 12) returns ['23'] which isn't right. How about: def...
 partition("TESTING123", 3) 


will return

['123', 'ING', 'EST', ''] 


which is missing a character.

Also,

 partition("TESTING123", 12) 


returns

 ['23'] 


which isn't right.

How about:

def partition(vString, vPart, vRightDirection = True):
	if vRightDirection:
		vString = vString[::-1]
	return [vString[i : i + vPart][::-1] for i in range(0, len(vString), vPart)]

UI-DEN-2236_UI 100% Coverage of the Application Software
UI-DEN-2236_UI 100% Coverage of the Application Software
Merge branch 'master' into DEN-1396_LogHandler

Changed the address of the shared drive to the newest address

- As part of the modification Dara had done on scripts this script was missing.

DEN-1617 : Implementation - Alarm Logging and Acknowledgment

- Added a unit test project for miscellaneous test which is not covered on feature based unit tests.

DEN-1617 : Implementation - Alarm Logging and Acknowledgment

- Added tst_logging

DEN-1090 : UI Message Handler / Error Handler

- updated the unit test project name

- added a can sender which reads CAN file and send it over the CAN Bus line by line.

  1. … 1 more file in changeset.
Added error result for QtTest

Give Squish Coco g++ wrapper the first priority

QtTest run fix

Fixed the QtTest UnitTest out files path

- Also added more logging

Updated the Unit Test Script for QtTest

- Added the QtTest builds for test

- Added merge results.

- Changed the bin files to be separated and merge-able.

unittest.sh edited online with Bitbucket

Revert back the [test]

unittest.sh edited online with Bitbucket

Build error for display [Test]

DEN-704_HomeScreen

- Updated script with the new SquishQt version (Python3) installation folder.

DEN-704_HomeScreen

- Updated the Unit Test Script to be able to easily run for local and server and more customizable.

Adding /DEN_UI to the report folder

- It was getting really messy on the server X: drive with all projects folder mixed up

  1. … 2 more files in changeset.
DEN-625 : Automation Script and Support

- Be able to bypass Unit Test Error to not to stop build.

DEN-625 : Automation Script and Support

- Be able to bypass Unit Test Error to not to stop build.