general topology – Why is my test that $ mathbb R $ disconnected incorrect?

The definition of connectivity in my notes is:
A topological space $ X $ is connected if a pair of non-empty subsets does not exist $ U $, $ V $ such that $ U cap V = emptyset $ Y $ U cup V = X $.

However, if I have the subsets $ (- infty, 0]$ Y $ (0, infty) $ then these are disjoint and cover $ mathbb R $ and therefore $ mathbb R $ is disconnected

but nevertheless $ mathbb R $ It is clearly connected. Where have I been wrong?