# Buggy code
def on_export_download(self):
    self.export_dir = QFileDialog.getExistingDirectory(
        self, "Please select the destination directory", "", QFileDialog.ShowDirsOnly
    )

    if len(self.export_dir) > 0:
        # Show confirmation dialog where we specify the name of the file
        infohash = self.selected_item.download_info["infohash"]
        self.dialog = ConfirmationDialog(
            self,
            "Export torrent file",
            "Please enter the name of the torrent file:",
            [("SAVE", BUTTON_TYPE_NORMAL), ("CANCEL", BUTTON_TYPE_CONFIRM)],
            show_input=True,
        )
        self.dialog.dialog_widget.dialog_input.setPlaceholderText("Torrent file name")
        self.dialog.dialog_widget.dialog_input.setText("%s.torrent" % infohash)
        self.dialog.dialog_widget.dialog_input.setFocus()
        self.dialog.button_clicked.connect(self.on_export_download_dialog_done)
        self.dialog.show()


# Traceback (AssertionError)
Tuples differ: (2, ('127.0.0.1', [5, 4, 3, 2,... != (2, ('127.0.0.1', [5, 4, 3, 2,...

First differing element 2:
u'None'
''

- (2, ('127.0.0.1', [5, 4, 3, 2, 1]), u'None')
?                                     - ----

+ (2, ('127.0.0.1', [5, 4, 3, 2, 1]), '')
Stacktrace

Traceback (most recent call last):
File "c:\python27\lib\unittest\case.py", line 329, in run
testMethod()
File "C:\workspace\jenkins\workspace\GH_Tribler_PR_tests_win64\tribler\Tribler\Test\test_as_server.py", line 58, in check
result = fun(*argv, **kwargs)
File "C:\workspace\jenkins\workspace\GH_Tribler_PR_tests_win64\tribler\Tribler\Test\Core\Upgrade\test_config_upgrade_70_71.py", line 33, in test_read_test_libtribler_conf
self.assertEqual(result_config.get_anon_proxy_settings(), (2, ("127.0.0.1", [5, 4, 3, 2, 1]), ''))
File "c:\python27\lib\unittest\case.py", line 513, in assertEqual
assertion_func(first, second, msg=msg)
File "c:\python27\lib\unittest\case.py", line 753, in assertTupleEqual
self.assertSequenceEqual(tuple1, tuple2, msg, seq_type=tuple)
File "c:\python27\lib\unittest\case.py", line 724, in assertSequenceEqual
self.fail(msg)
File "c:\python27\lib\unittest\case.py", line 410, in fail
raise self.failureException(msg)
AssertionError: Tuples differ: (2, ('127.0.0.1', [5, 4, 3, 2,... != (2, ('127.0.0.1', [5, 4, 3, 2,...

First differing element 2:
u'None'
''

- (2, ('127.0.0.1', [5, 4, 3, 2, 1]), u'None')
?                                     - ----

+ (2, ('127.0.0.1', [5, 4, 3, 2, 1]), '')

# Fixed code
def on_export_download(self):
    self.export_dir = QFileDialog.getExistingDirectory(
        self, "Please select the destination directory", "", QFileDialog.ShowDirsOnly
    )

    if len(self.export_dir) > 0:
        # Show confirmation dialog where we specify the name of the file
        torrent_name = self.selected_item.download_info["name"]
        self.dialog = ConfirmationDialog(
            self,
            "Export torrent file",
            "Please enter the name of the torrent file:",
            [("SAVE", BUTTON_TYPE_NORMAL), ("CANCEL", BUTTON_TYPE_CONFIRM)],
            show_input=True,
        )
        self.dialog.dialog_widget.dialog_input.setPlaceholderText("Torrent file name")
        self.dialog.dialog_widget.dialog_input.setText("%s.torrent" % torrent_name)
        self.dialog.dialog_widget.dialog_input.setFocus()
        self.dialog.button_clicked.connect(self.on_export_download_dialog_done)
        self.dialog.show()