return updates
def clear(self) -> None:
- for key, value in [(k, v) for k, v in self._deep_annotations().items()
- if k not in self._keep_on_clear]:
+ # re-set isupports first, since other items depend on its defaults,
+ # e.g. .users.userlen
+ start_with = ['isupport']
+ for key in start_with + sorted(
+ k for k in self._deep_annotations().keys()
+ if k not in self._keep_on_clear | set(start_with)):
+ value = self._deep_annotations()[key]
if hasattr(value, '__origin__'):
value = value.__origin__
if issubclass(value, _Clearable):
# on /connect init databases, log in new windows
> /connect foo.bar.baz foo:bar baz:foobarbazquux
-, $ DISCONNECTED
+|isupport-clear-in
1 $ isupport cleared
1 $ isupport:CHANTYPES set to: [#&]
1 $ isupport:PREFIX set to: [(ov)@+]
1 $ isupport:USERLEN set to: [10]
+|isupport-clear-out
1 $ caps cleared
1 $ users cleared
1 $ channels cleared
+, $ DISCONNECTED
# connect with values set by /connect, init CAP negotation
1 $ hostname set to: [foo.bar.baz]
1 $ channels:#testtest:exits:me cleared
0:1 < ERROR :Closing link: (~foobarbaz@baz.bar.foo) [Quit: ircplom says bye]
1 $ connection_state set to: [Closing link: (~foobarbaz@baz.bar.foo) [Quit: ircplom says bye]]
+repeat isupport-clear-in isupport-clear-out
+1 $ caps cleared
+1 $ channels cleared
1 $ connection_state set to: []
2,3,4,5,6,7 $ DISCONNECTED
-1 $ isupport cleared
-1 $ isupport:CHANTYPES set to: [#&]
-1 $ isupport:PREFIX set to: [(ov)@+]
-1 $ isupport:USERLEN set to: [10]
1 $ motd set to:
1 $ sasl_account set to: []
1 $ sasl_auth_state set to: []
-1 $ caps cleared
-1 $ channels cleared
-1 $ users cleared
# fail to send in disconnect, check alert window is command prompt window
> /window 6
> /privmsg barbar test
+1 $ users cleared
6 !$ cannot send, connection seems closed
> /window 1
> /privmsg barbar test
# test setting up second client, but 432 irrecoverably
> /connect baz.bar.foo ?foo foo:foo
-, $ DISCONNECTED
8 $ isupport cleared
8 $ isupport:CHANTYPES set to: [#&]
8 $ isupport:PREFIX set to: [(ov)@+]
8 $ caps cleared
8 $ users cleared
8 $ channels cleared
+, $ DISCONNECTED
8 $ hostname set to: [baz.bar.foo]
8 $ port set to: [-1]
8 $ nick_wanted set to: [?foo]
1:8 > USER foo 0 * :foo
1:8 > NICK :?foo
1:8 < :*.?.net 432 * ?foo :Erroneous nickname
-8 $ connection_state set to: []
-, $ DISCONNECTED
8 $ isupport cleared
8 $ isupport:CHANTYPES set to: [#&]
8 $ isupport:PREFIX set to: [(ov)@+]
8 $ isupport:USERLEN set to: [10]
+8 $ connection_state set to: []
+, $ DISCONNECTED
8 !$ nickname refused for bad format, giving up
# test failing third connection
> /connect baz.baz.baz baz baz:baz
-, $ DISCONNECTED
9 $ isupport cleared
9 $ isupport:CHANTYPES set to: [#&]
9 $ isupport:PREFIX set to: [(ov)@+]
9 $ caps cleared
9 $ users cleared
9 $ channels cleared
+, $ DISCONNECTED
9 $ hostname set to: [baz.baz.baz]
9 $ port set to: [-1]
9 $ nick_wanted set to: [baz]
2:9 > NICK :baz
2: < FAKE_IRC_CONN_ABORT_EXCEPTION
9 $ connection_state set to: [broken: FAKE_IRC_CONN_ABORT_EXCEPTION]
-9 $ connection_state set to: []
-, $ DISCONNECTED
9 $ isupport cleared
9 $ isupport:CHANTYPES set to: [#&]
9 $ isupport:PREFIX set to: [(ov)@+]
9 $ isupport:USERLEN set to: [10]
+9 $ connection_state set to: []
+, $ DISCONNECTED
# check that (save TUI tests assuming start on window 0, and no 4 yet) on reconnect, all the same effects can be expected
> /reconnect