def test_unique_id_generation(self): guid = GUID() self.assertEqual('n0', guid.next('n')) self.assertEqual('n1', guid.next('n')) self.assertEqual('e0', guid.next('e')) self.assertEqual('n2', guid.next('n')) self.assertEqual('e1', guid.next('e')) self.assertEqual({'n': 2, 'e': 1}, guid.ids)
def test_unique_id_generation(self): guid = GUID() assert 'n0' == guid.next('n') assert 'n1' == guid.next('n') assert 'e0' == guid.next('e') assert 'n2' == guid.next('n') assert 'e1' == guid.next('e') assert {'n': 2, 'e': 1} == guid.ids
def test_unique_id_generation_with_exception(self): guid = GUID() with pytest.raises(ValueError): guid.next('1') with pytest.raises(ValueError): guid.next('n1') with pytest.raises(ValueError): guid.next('n 1')
def __init__(self, name, parent): """ Initialize the diagram. :type name: str :type parent: Project """ super().__init__(parent) self.factory = ItemFactory(self) self.guid = GUID(self) self.mode = DiagramMode.Idle self.modeParam = Item.Undefined self.name = name self.pasteX = Clipboard.PasteOffsetX self.pasteY = Clipboard.PasteOffsetY self.mo_Node = None self.mp_Data = None self.mp_Edge = None self.mp_Label = None self.mp_LabelPos = None self.mp_Node = None self.mp_NodePos = None self.mp_Pos = None settings = QtCore.QSettings() self.setFont( Font(font=self.font(), pixelSize=settings.value('diagram/fontsize', self.font().pixelSize(), int))) connect(self.sgnItemAdded, self.onItemAdded) connect(self.sgnItemRemoved, self.onItemRemoved) connect(self.sgnNodeIdentification, self.doNodeIdentification)
def __init__(self, name, parent): """ Initialize the diagram. :type name: str :type parent: Project """ super().__init__(parent) self.factory = ItemFactory(self) self.guid = GUID(self) self.mode = DiagramMode.Idle self.modeParam = Item.Undefined self.name = name self.pasteX = Clipboard.PasteOffsetX self.pasteY = Clipboard.PasteOffsetY self.mo_Node = None self.mp_Data = None self.mp_Edge = None self.mp_Label = None self.mp_LabelPos = None self.mp_Node = None self.mp_NodePos = None self.mp_Pos = None connect(self.sgnItemAdded, self.onItemAdded) connect(self.sgnItemRemoved, self.onItemRemoved) connect(self.sgnNodeIdentification, self.doNodeIdentification)
def test_unique_id_parse_with_exception(self): with pytest.raises(ValueError): GUID.parse('1') with pytest.raises(ValueError): GUID.parse('n') with pytest.raises(ValueError): GUID.parse('n 8')
def test_unique_id_parse(self): assert ('n', 8) == GUID.parse('n8') assert ('e', 122) == GUID.parse('e122')
def test_unique_id_update(self): guid = GUID() guid.update('n19') guid.update('e7') assert {'n': 19, 'e': 7} == guid.ids
def test_unique_id_parse(self): self.assertEqual(('n', 8), GUID.parse('n8')) self.assertEqual(('e', 122), GUID.parse('e122'))
def test_unique_id_update(self): guid = GUID() guid.update('n19') guid.update('e7') self.assertEqual({'n': 19, 'e': 7}, guid.ids)
def test_unique_id_generation_with_exception(self): guid = GUID() self.assertRaises(ValueError, guid.next, '1') self.assertRaises(ValueError, guid.next, 'n1') self.assertRaises(ValueError, guid.next, 'n 1')