Is a function between topological spaces continuous if continuous on subspaces? Assume that there are two topological spaces $X,Y$ and a function $f:X\rightarrow Y$. Furthermore, assume that there exists a collection of sets $\mathcal{B}$ such that
$\bigcup_{B\in \mathcal{B}} B = X,$
and for each $B \in \mathcal{B}$ the restriction $f|_B$ is continuous with respect to the subspace topology.
Is this enough to say that $f$ is continuous on the whole space?
 A: As pointed out by others in the comments, this in general fails.
The most relevant positive result (other than those mentioned by @Henno Brandsma) is the Pasting lemma, which states that this holds when $\mathcal B$ is finite and each $B\in\mathcal B$ is closed.
A: A more general statement than @Just a user.
If $\{U_{\alpha}\}_{\alpha\in A}$ form a fundamental cover of $X$. Then $f:X\to Y$is continuous if and only if $f|_{U_{\alpha}}$ is continuous $\forall\alpha\in A$
Definition of fundamental cover:-
A cover $\{U_{\alpha}\}_{\alpha\in A}$ is called a fundamental cover if $V\subset X$ open $\iff$ $V\cap U_{\alpha}$ is open in the subspace topology $\forall\alpha\in A$ .
It can be proven that an open cover is fundamental. A cover of $X$ by finite number of closed sets is fundamental. A locally finite cover by closed sets is fundamental. In these cases you can conclude continuity. For other cases you have to check by hand as these are only necessary conditions for a cover to be fundamental.
