Best Python code snippet using fMBT_python
bt_webhook_options.py
Source:bt_webhook_options.py
1# coding: utf-82"""3 Onshape REST API4 The Onshape REST API consumed by all clients. # noqa: E5015 OpenAPI spec version: 1.976 Contact: api-support@onshape.zendesk.com7 Generated by: https://openapi-generator.tech8"""9import pprint10import re # noqa: F40111import six12class BTWebhookOptions(object):13 """NOTE: This class is auto generated by OpenAPI Generator.14 Ref: https://openapi-generator.tech15 Do not edit the class manually.16 """17 """18 Attributes:19 openapi_types (dict): The key is attribute name20 and the value is attribute type.21 attribute_map (dict): The key is attribute name22 and the value is json key in definition.23 """24 openapi_types = {25 'collapse_events': 'bool'26 }27 attribute_map = {28 'collapse_events': 'collapseEvents'29 }30 def __init__(self, collapse_events=None): # noqa: E50131 """BTWebhookOptions - a model defined in OpenAPI""" # noqa: E50132 self._collapse_events = None33 self.discriminator = None34 if collapse_events is not None:35 self.collapse_events = collapse_events36 @property37 def collapse_events(self):38 """Gets the collapse_events of this BTWebhookOptions. # noqa: E50139 :return: The collapse_events of this BTWebhookOptions. # noqa: E50140 :rtype: bool41 """42 return self._collapse_events43 @collapse_events.setter44 def collapse_events(self, collapse_events):45 """Sets the collapse_events of this BTWebhookOptions.46 :param collapse_events: The collapse_events of this BTWebhookOptions. # noqa: E50147 :type: bool48 """49 self._collapse_events = collapse_events50 def to_dict(self):51 """Returns the model properties as a dict"""52 result = {}53 for attr, _ in six.iteritems(self.openapi_types):54 value = getattr(self, attr)55 if isinstance(value, list):56 result[attr] = list(map(57 lambda x: x.to_dict() if hasattr(x, "to_dict") else x,58 value59 ))60 elif hasattr(value, "to_dict"):61 result[attr] = value.to_dict()62 elif isinstance(value, dict):63 result[attr] = dict(map(64 lambda item: (item[0], item[1].to_dict())65 if hasattr(item[1], "to_dict") else item,66 value.items()67 ))68 else:69 result[attr] = value70 return result71 def to_str(self):72 """Returns the string representation of the model"""73 return pprint.pformat(self.to_dict())74 def __repr__(self):75 """For `print` and `pprint`"""76 return self.to_str()77 def __eq__(self, other):78 """Returns true if both objects are equal"""79 if not isinstance(other, BTWebhookOptions):80 return False81 return self.__dict__ == other.__dict__82 def __ne__(self, other):83 """Returns true if both objects are not equal"""...
collapseTest.py
Source:collapseTest.py
...4# Happy path: nominal value within bounds5 def test100_010_ShouldCollapseOneGoodDigit(self):6 value = '5'7 expectedResult = '5'8 actualResult = collapse.collapse(value)9 self.assertEqual(expectedResult, actualResult)10 def test_ShouldCollapseOneGoodDigit(self):11 value = '0'12 expectedResult = '0'13 actualResult = collapse.collapse(value)14 self.assertEqual(expectedResult, actualResult)15 16 def test_ShouldCollapseTwoGoodDigits(self):17 value = '10'18 expectedResult = '1'19 actualResult = collapse.collapse(value)20 self.assertEqual(expectedResult, actualResult)21 22 def test_ShouldCollapseThreeGoodDigits(self):23 value = '123'24 expectedResult = '6'25 actualResult = collapse.collapse(value)26 self.assertEqual(expectedResult, actualResult)27 28 def test_ShouldCollapseTwoSameGoodDigits(self):29 value = '99'30 expectedResult = '9'31 actualResult = collapse.collapse(value)32 self.assertEqual(expectedResult, actualResult)33 34 def test_ShouldCollapseFiveGoodDigits(self):35 value = '98769'36 expectedResult = '3'37 actualResult = collapse.collapse(value)38 self.assertEqual(expectedResult, actualResult)39 40 def test_ShouldNotCollapseZeroGoodDigits(self):41 value = ''42 expectedResult = None43 actualResult = collapse.collapse(value)44 self.assertEqual(expectedResult, actualResult)45 46 def test_ShouldNotCollapseOneBadDigits(self):47 value = 'a'48 expectedResult = None49 actualResult = collapse.collapse(value)50 self.assertEqual(expectedResult, actualResult)51 52 def test_ShouldNotCollapseValueBelowZero(self):53 value = '-1'54 expectedResult = None55 actualResult = collapse.collapse(value)56 self.assertEqual(expectedResult, actualResult)57 58 def test_ShouldNotCollapseWithoutParentheses(self):59 value = 160 expectedResult = None61 actualResult = collapse.collapse(value)...
test_PeacockCollapsibleWidget.py
Source:test_PeacockCollapsibleWidget.py
1#!/usr/bin/env python32#* This file is part of the MOOSE framework3#* https://www.mooseframework.org4#*5#* All rights reserved, see COPYRIGHT for full restrictions6#* https://github.com/idaholab/moose/blob/master/COPYRIGHT7#*8#* Licensed under LGPL 2.1, please see LICENSE for details9#* https://www.gnu.org/licenses/lgpl-2.1.html10import sys11import unittest12from PyQt5 import QtWidgets13import peacock14class TestPeacockCollapsibleWidget(unittest.TestCase):15 """16 Test collapsible regions.17 """18 qapp = QtWidgets.QApplication(sys.argv)19 def testCollapseDefault(self):20 collapse = peacock.base.PeacockCollapsibleWidget(title='The Title')21 main = collapse.collapsibleLayout()22 widget = QtWidgets.QWidget()23 main.addWidget(widget)24 self.assertFalse(collapse.isCollapsed())25 collapse._callbackHideButton()26 self.assertTrue(collapse.isCollapsed())27 collapse._callbackHideButton()28 self.assertFalse(collapse.isCollapsed())29 self.assertEqual(collapse._title_widget.text(), 'The Title')30 def testCollapseStartCollapse(self):31 collapse = peacock.base.PeacockCollapsibleWidget(collapsed=True, title='The Title')32 main = collapse.collapsibleLayout()33 widget = QtWidgets.QWidget()34 main.addWidget(widget)35 self.assertTrue(collapse.isCollapsed())36 collapse._callbackHideButton()37 self.assertFalse(collapse.isCollapsed())38 collapse._callbackHideButton()39 self.assertTrue(collapse.isCollapsed())40if __name__ == '__main__':...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!