class TestBoardSerializeDeserialize(unittest.TestCase): board = Board('Story Map', [ Cut('ReleaseA', [ SwimLane('Todo', [ Card('Too many code, to many concepts.'), Card('Cats is cuts with nuts.') ]) ]) ]) def test__to_dict__from_dict(self): expected = self.board dict_ = self.board.to_dict() result = Board.from_dict(dict_) self.assertEqual(expected, result) def test__to_json_file__from_json_file(self): path = 'ng_django/examples/dsl_board/board.json' expected = self.board expected.to_json_file(path) result = Board.from_json_file(path) self.assertEqual(expected, result) def test__to_json__from_json(self): expected = self.board result = Board.from_json(expected.to_json()) self.assertEqual(expected, result)
def test__to_dict__from_dict(self): expected = self.board dict_ = self.board.to_dict() result = Board.from_dict(dict_) self.assertEqual(expected, result)
def test__to_json_file__from_json_file(self): path = 'ng_django/examples/dsl_board/board.json' expected = self.board expected.to_json_file(path) result = Board.from_json_file(path) self.assertEqual(expected, result)
def test(self): # expected = Board(name='Интернет магазин', rows=[]) expected = Board(name='TEST', rows=[]) text = """ [board] name = Интернет магазин """ result = BoardIniParser().parse(text) self.assertEqual(expected, result)
class TestMethodChainingCreation(unittest.TestCase): board = Board('Story Map', [ Cut('ReleaseA', [ SwimLane('Todo', [ Card('Too many code, to many concepts.'), Card('Cats is cuts with nuts.') ]) ]) ]) @unittest.skip('') def test(self): expected = self.board result = \ board('Story Map', ( cut('ReleaseA') .swimlane('Todo') .card('Too many code, to many concepts.') .card('Cats is cuts with nuts.') )) self.assertEqual(expected, result)
def parse_section(self, line): section_name = re.search(r'^\s*\[(.*)\]', line).groups(0)[0] if section_name == 'board': self.board = Board(name='TEST', rows=[]) return raise ValueError('Section not found')
def test__to_json__from_json(self): expected = self.board result = Board.from_json(expected.to_json()) self.assertEqual(expected, result)
def board(name, cuts): return Board(name, cuts)
def test_board_is_empty(self): board = Board('', None) result = board.is_empty() self.assertTrue(result)
def test_board_is_not_empty__with_one_cut(self): board = Board('', [1]) result = board.is_empty() self.assertFalse(result)